@Test public void testDeleteAllEntities() { 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.deleteAll(); assertNull("Checking that the result is null.", repository.findById(t1.getId())); assertNull("Checking that the result is null.", repository.findById(t2.getId())); }
@Test public void testFindOne() { List<TestEntity> values = Arrays.asList(1, 2) .stream() .map( v -> { TestEntity t = new TestEntity(); t.setStringProperty(String.format("Hello %s time(s)", v)); return t; }) .collect(Collectors.toList()); repository.save(values); TestEntity actual = repository.findOne(values.get(1).getId()); assertNotNull("Checking that the result is not null.", actual); assertEquals( "Checking that the list is the expected size.", values.get(1).getId(), actual.getId()); assertEquals( "Checking that the list is the expected size.", values.get(1).getStringProperty(), actual.getStringProperty()); }
@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); }