DefaultFacade implements Facade<RESOURCE, RESOURCELIST, KEY> { @Override public void removeResource(final KEY id) { LOG.info("Removing resource with id: {}", id); ENTITY entity = service.getEntity(id); service.removeEntity(entity); }  @Override RESOURCE createResource(final RESOURCE resource); @Override RESOURCE getResource(final KEY id); @Override void removeResource(final KEY id); @Override void updateResource(final KEY id, final RESOURCE resource); @Override PagedResultResource<RESOURCE> getResources(final PagedRequest<RESOURCELIST> request); @Required void setService(final SERVICE service); @Required void setResourceConverter(final Converter<RESOURCE, ENTITY> resourceConverter); @Required void setEntityConverter(final Converter<ENTITY, RESOURCE> entityConverter); @Required void setPagedRequestConverter(final Converter<PagedRequest<RESOURCELIST>, MultiplePagedSearch<ENTITYLIST>> pagedRequestConverter); @Required void setPagedResultConverter(final Converter<PagedResult<ENTITY>, PagedResultResource<RESOURCE>> pagedResultConverter); @Required void setInsertConverter(final Converter<RESOURCE, ENTITY> insertConverter); @Required void setEntityDetailsConverter(final Converter<ENTITY, RESOURCE> entityDetailsConverter); SERVICE getService(); Converter<ENTITY, RESOURCE> getEntityDetailsConverter(); void setUpdateConverter(final Converter<RESOURCE, ENTITY> updateConverter); Converter<RESOURCE, ENTITY> getResourceConverter(); Converter<ENTITY, RESOURCE> getEntityConverter(); Converter<PagedRequest<RESOURCELIST>, MultiplePagedSearch<ENTITYLIST>> getPagedRequestConverter(); Converter<PagedResult<ENTITY>, PagedResultResource<RESOURCE>> getPagedResultConverter(); Converter<RESOURCE, ENTITY> getInsertConverter(); Converter<RESOURCE, ENTITY> getUpdateConverter(); Converter<RESOURCELIST, ENTITYLIST> getResourceListConverter(); void setResourceListConverter(final Converter<RESOURCELIST, ENTITYLIST> resourceListConverter);  }
@Test public void testRemoveEntity() throws Exception { Long id = 1L; String group = "developers"; Person person = new Person(); person.setId(id); person.setCrtUserGroup(group); when(service.getEntity(anyLong())).thenReturn(person); unit.removeResource(id); verify(service).getEntity(id); verify(service).removeEntity(person); }