Skip to content

Instantly share code, notes, and snippets.

@tqvarnst
Last active March 8, 2016 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tqvarnst/4772dd2299f4e9810944 to your computer and use it in GitHub Desktop.
Save tqvarnst/4772dd2299f4e9810944 to your computer and use it in GitHub Desktop.
Arquillian test for LocalDateTime in Hibernate 5 and JBoss EAP 7
@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