Last active
March 8, 2016 13:41
-
-
Save tqvarnst/4772dd2299f4e9810944 to your computer and use it in GitHub Desktop.
Arquillian test for LocalDateTime in Hibernate 5 and JBoss EAP 7
This file contains 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
@RunWith(Arquillian.class) | |
public class LocalDateTimeTest { | |
@EJB | |
PersonService personService; | |
@Deployment | |
public static Archive<?> createDeployment() { | |
JavaArchive archive = ShrinkWrap.create(JavaArchive.class) | |
.addAsResource("META-INF/persistence.xml","META-INF/persistence.xml") | |
.addPackages(true,"com.redhat.demos") | |
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | |
return archive; | |
} | |
@Test | |
@UsingDataSet({"person.yml","task.yml"}) | |
public void testLocalDateTime() { | |
Person person = personService.getPerson(1001L); | |
Set<Task> tasks = person.getTasks(); | |
assertEquals(3,tasks.size()); | |
Task task = tasks.stream().filter(t -> t.getId() == 2001).findAny().get(); | |
assertNotNull(task); | |
assertEquals(2016,task.getCreationDate().getYear()); | |
assertEquals(Month.FEBRUARY,task.getCreationDate().getMonth()); | |
assertEquals(11,task.getCreationDate().getDayOfMonth()); | |
assertEquals(11,task.getCreationDate().getHour()); | |
assertEquals(46,task.getCreationDate().getMinute()); | |
assertEquals(23,task.getCreationDate().getSecond()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment