@Test public void testDeleteById() { Event event = genEvent(); dataRepository.save(event); dataRepository.delete(event.getId()); Assert.assertFalse(dataRepository.exists(event.getId())); }
@Test public void testExists() { dataRepository.save(genEvent()); boolean isExist = dataRepository.exists(new Object[] {1, "TEST_USER", 1434441175000l, 1434441177000l}); Assert.assertTrue(isExist); }
@Test public void testDeleteByIdBatch() { List<Event> events = new LinkedList<Event>(); for (int i = 0; i < 10; i++) { events.add(genEvent()); } dataRepository.save(events); List<Object[]> ids = new LinkedList<Object[]>(); for (Event e : events) { Assert.assertTrue(dataRepository.exists(e.getId())); ids.add(e.getId()); } dataRepository.delete(ids); for (Event e : events) { Assert.assertFalse(dataRepository.exists(e.getId())); ids.add(e.getId()); } }
@Test public void testSaveBatch() { List<Event> events = new LinkedList<Event>(); for (int i = 0; i < 10; i++) { events.add(genEvent()); } dataRepository.save(events); for (Event e : events) { Assert.assertTrue(dataRepository.exists(e.getId())); } }
@Test public void testSave() { Event Event = genEvent(); dataRepository.save(Event); Assert.assertTrue(dataRepository.exists(Event.getId())); }