use of com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutionProfilesList in project sechub by mercedes-benz.
the class ProductExecutionProfileRestControllerRestDocTest method restDoc_admin_fetches_profiles_list.
@Test
@UseCaseRestDoc(useCase = UseCaseAdminFetchesExecutionProfileList.class)
public void restDoc_admin_fetches_profiles_list() throws Exception {
/* prepare */
String apiEndpoint = https(PORT_USED).buildAdminFetchesListOfProductExecutionProfiles();
Class<? extends Annotation> useCase = UseCaseAdminFetchesExecutionProfileList.class;
TestExecutionProfileList profileList = new TestExecutionProfileList();
TestExecutionProfileListEntry entry1 = new TestExecutionProfileListEntry();
entry1.description = "A short decription for profile1";
entry1.id = "profile1";
TestExecutionProfileListEntry entry2 = new TestExecutionProfileListEntry();
entry2.description = "A short decription for profile2";
entry2.id = "profile2";
profileList.executionProfiles.add(entry1);
profileList.executionProfiles.add(entry2);
ProductExecutionProfilesList list = JSONConverter.get().fromJSON(ProductExecutionProfilesList.class, JSONConverter.get().toJSON(profileList));
when(fetchListService.fetchProductExecutionProfileList()).thenReturn(list);
/* execute + test @formatter:off */
this.mockMvc.perform(get(apiEndpoint).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()).andDo(defineRestService().with().useCaseData(useCase).tag(RestDocFactory.extractTag(apiEndpoint)).responseSchema(OpenApiSchema.EXECUTION_PROFILE_LIST.getSchema()).and().document(responseFields(fieldWithPath("type").description("Always `executorProfileList` as an identifier for the list"), fieldWithPath("executionProfiles[]." + PROPERTY_ID).description("The profile id"), fieldWithPath("executionProfiles[]." + PROPERTY_DESCRIPTION).description("A profile description"), fieldWithPath("executionProfiles[]." + PROPERTY_ENABLED).description("Enabled state of profile"))));
/* @formatter:on */
}
Aggregations