BaseEntityMemoryStore implements Store<T, UUID> { public void delete(@Valid T entity) throws EntityDoesNotExistException { if (!exists(entity)) { throw new EntityDoesNotExistException(); } entities.remove(entity.getId()); }  T create(@Valid T entity); void update(@Valid T entity); void delete(@Valid T entity); Integer countAll(); List<T> findAll(Integer number, Integer offset); List<T> findByIds(final List<UUID> ids); T findById(UUID id);  }
@Test(expected = EntityDoesNotExistException.class) public void testDeleteEntityWithNoIdThrowsException() throws Exception { store.delete(new MyEntity()); }
@Test(expected = EntityDoesNotExistException.class) public void testDeleteEntityThatDoesNotExistsThrowsException() throws Exception { store.delete(new MyEntity(UUID.randomUUID())); }