-
-
Save wingyplus/4318791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package th.co.osdev.alfresco.filemigration.dao; | |
import static org.hamcrest.CoreMatchers.notNullValue; | |
import static org.junit.Assert.assertThat; | |
import java.util.Date; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.test.context.ContextConfiguration; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
import th.co.osdev.alfresco.filemigration.domain.FileConversion; | |
import th.co.osdev.alfresco.filemigration.enums.Status; | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration(locations = { "classpath:test-datasource-context.xml" }) | |
public class FileConversionDAOTest { | |
@Autowired | |
private FileConversionDAO fileConversionDao; | |
@Before | |
public void setUp() throws Exception { | |
} | |
@After | |
public void tearDown() throws Exception { | |
} | |
@Test | |
public void whenCallSaveDaoMustBeReturnFileMigrateHaveId() { | |
// setup | |
Date timestamp = new Date(); | |
FileConversion fileConversion = new FileConversion(); | |
// given | |
fileConversion.setFilename("a.txt"); | |
fileConversion.setPath("/home/test/a"); | |
fileConversion.setFromCSV("a.csv"); | |
fileConversion.setDestination("/mydestination"); | |
fileConversion.setStatus(Status.PASS); | |
fileConversion.setTimestamp(timestamp); | |
// when | |
FileConversion resultFileMigrate = fileConversionDao | |
.save(fileConversion); | |
// then | |
assertThat(resultFileMigrate, notNullValue()); | |
assertThat(resultFileMigrate.getId(), notNullValue()); // expected id has value not null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment