### Question:
ListAttributeGroups { public ListAttributeGroupsEngineResponseDto process() throws ApplicationException { if (request.getNamespace() == null) { throw new ApplicationException("no namespace given"); } if (request.getOrganismId() == 0) { throw new ApplicationException("no organism id specified, but don't know how to list all organisms. yet."); } AttributeGroups data = cache.getAttributeGroups(request.getNamespace(), request.getOrganismId()); data.getAttributeGroups(); ListAttributeGroupsEngineResponseDto response = new ListAttributeGroupsEngineResponseDto(); Collection<Long> ids = new ArrayList<Long>(data.getAttributeGroups().keySet()); response.setAttributeGroupIds(ids); return response; } ListAttributeGroups(DataCache cache,
            ListAttributeGroupsEngineRequestDto request); ListAttributeGroupsEngineResponseDto process();  }### Answer:
@Test public void testListCore() throws Exception { ListAttributeGroupsEngineRequestDto request = new ListAttributeGroupsEngineRequestDto(); request.setNamespace(Data.CORE); request.setOrganismId(config.getOrg1Id()); ListAttributeGroups listAttributeGroupsAction = new ListAttributeGroups(cacheBuilder.getCache(), request); ListAttributeGroupsEngineResponseDto result = listAttributeGroupsAction.process(); assertNotNull(result); assertEquals(config.getNumAttributeGroups(), result.getAttributeGroupIds().size()); }
@Test(expected=ApplicationException.class) public void testListCoreFromUser() throws Exception { String namespace = "user1"; ListAttributeGroupsEngineRequestDto request = new ListAttributeGroupsEngineRequestDto(); request.setNamespace(namespace); request.setOrganismId(config.getOrg1Id()); ListAttributeGroups listAttributeGroupsAction = new ListAttributeGroups(cacheBuilder.getCache(), request); ListAttributeGroupsEngineResponseDto result = listAttributeGroupsAction.process(); }
@Test public void testListUser() throws Exception { String namespace = "user1"; long attributeGroupId = -1; createUserAttributeGroup(namespace, config.getOrg1Id(), attributeGroupId, 10); ListAttributeGroupsEngineRequestDto request = new ListAttributeGroupsEngineRequestDto(); request.setNamespace(namespace); request.setOrganismId(config.getOrg1Id()); ListAttributeGroups listAttributeGroupsAction = new ListAttributeGroups(cacheBuilder.getCache(), request); ListAttributeGroupsEngineResponseDto result = listAttributeGroupsAction.process(); assertNotNull(result); assertEquals(config.getNumAttributeGroups() + 1, result.getAttributeGroupIds().size()); }