use of io.cryostat.util.resource.ClassPropertiesLoader in project cryostat by cryostatio.
the class OpenShiftAuthManagerTest method testPropertiesResourceMapProcessing.
@ParameterizedTest
@MethodSource("getResourceMaps")
void testPropertiesResourceMapProcessing(Map<String, Object> map) throws IOException {
ClassPropertiesLoader loader = Mockito.mock(ClassPropertiesLoader.class);
Map<String, String> resourcesMap = new HashMap<>();
map.entrySet().stream().filter(e -> !e.getKey().equals("expected")).forEach(e -> resourcesMap.put((String) e.getKey(), (String) e.getValue()));
Map<ResourceType, Set<GroupResource>> expected = (Map<ResourceType, Set<GroupResource>>) map.get("expected");
Mockito.when(loader.loadAsMap(Mockito.any())).thenReturn(resourcesMap);
Map<ResourceType, Set<GroupResource>> result = OpenShiftAuthManager.processResourceMapping(loader, logger);
MatcherAssert.assertThat(result, Matchers.equalTo(expected));
}
Aggregations