@Test public void getEventoTest() { EventoEntity entity = data.get(0); EventoEntity newEntity = eventoPersistence.find(entity.getId()); Assert.assertNotNull(newEntity); Assert.assertEquals(entity.getName(), newEntity.getName()); }
@Test public void deleteEventoTest() { EventoEntity entity = data.get(0); eventoPersistence.delete(entity.getId()); EventoEntity deleted = em.find(EventoEntity.class, entity.getId()); Assert.assertNull(deleted); }
@Test public void createEventoTest() { EventoEntity newEntity = factory.manufacturePojo(EventoEntity.class); EventoEntity result = eventoPersistence.create(newEntity); Assert.assertNotNull(result); EventoEntity entity = em.find(EventoEntity.class, result.getId()); Assert.assertEquals(newEntity.getName(), entity.getName()); }
@Test public void updateEventoTest() { EventoEntity entity = data.get(0); EventoEntity newEntity = factory.manufacturePojo(EventoEntity.class); newEntity.setId(entity.getId()); eventoPersistence.update(newEntity); EventoEntity resp = em.find(EventoEntity.class, entity.getId()); Assert.assertEquals(newEntity.getName(), resp.getName()); }
@Test public void getEventosTest() { List<EventoEntity> list = eventoPersistence.findAll(); Assert.assertEquals(data.size(), list.size()); for (EventoEntity ent : list) { boolean found = false; for (EventoEntity entity : data) { if (ent.getId().equals(entity.getId())) { found = true; } } Assert.assertTrue(found); } }