@Test public void testDeleteEntity() { TestEntity t = new TestEntity(); t.setStringProperty(String.format("Hello World!")); repository.save(t); repository.delete(Arrays.asList(t)); TestEntity actual = repository.findById(t.getId()); assertNull("Checking that the result is null.", actual); }
@Test public void testDeleteEntities() { TestEntity t1 = new TestEntity(); t1.setStringProperty(String.format("1")); TestEntity t2 = new TestEntity(); t2.setStringProperty(String.format("2")); repository.save(Arrays.asList(t1, t2)); repository.delete(Arrays.asList(t1, t2)); assertNull("Checking that the result is null.", repository.findById(t1.getId())); assertNull("Checking that the result is null.", repository.findById(t2.getId())); }
/** * Because of an issue with wiremock, specifically related to PUT operations following GET * operations, I'm adding this before block. If the save op fails, it should only fail the first * time. */ @Before public void before() { TestEntity e = new TestEntity(); try { repository.save(e); } catch (Exception e1) { } try { repository.delete(e); } catch (Exception e1) { } preSaveCount.set(0); postSaveCount.set(0); }