ResourceTypeManagerCache { public Set<ResourceTypeDefinition> getResourceTypeDefinitions() { return this.resourceActivities.stream() .map(activityAndMetaInfo -> this.getResourceTypes(activityAndMetaInfo)) .flatMap(Collection::stream) .collect(Collectors.toSet()); } @Inject  ResourceTypeManagerCache(CategoriesManagerCache categoriesManagerCache); void addAll(List<ClientResourceType> resourceTypeDefinitions); Set<ResourceTypeDefinition> getResourceTypeDefinitions(); List<ActivityAndMetaInfo> getResourceActivities(); void addResourceActivity(ActivityAndMetaInfo activityAndMetaInfo); List<ResourceTypeDefinition> getResourceTypeDefinitionsByCategory(Category category); void sortResourceActivitiesByPriority();  }
@Test public void testGetResourceTypeDefinitions() { Category process = mock(Category.class); when(process.getName()).thenReturn("PROCESS"); Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(process)) .isEmpty(); Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(modelEditorDef.getCategory())) .hasSize(1) .containsExactly(modelEditorDef.getResourceType()); Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(formEditorDef.getCategory())) .hasSize(1) .containsExactly(formEditorDef.getResourceType()); }