use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveJobDataList in project sechub by mercedes-benz.
the class FalsePositiveRestControllerRestDocTest method restdoc_mark_false_positives_for_job.
@Test
@UseCaseRestDoc(useCase = UseCaseUserMarksFalsePositivesForJob.class)
public void restdoc_mark_false_positives_for_job() throws Exception {
/* prepare */
String apiEndpoint = https(PORT_USED).buildUserAddsFalsePositiveJobDataListForProject(PROJECT_ID.pathElement());
Class<? extends Annotation> useCase = UseCaseUserMarksFalsePositivesForJob.class;
FalsePositiveJobDataList jobDataList = new FalsePositiveJobDataList();
jobDataList.setApiVersion("1.0");
List<FalsePositiveJobData> list = jobDataList.getJobData();
FalsePositiveJobData data = new FalsePositiveJobData();
data.setComment("an optional comment why this is a false positive...");
data.setFindingId(42);
data.setJobUUID(UUID.fromString("f1d02a9d-5e1b-4f52-99e5-401854ccf936"));
list.add(data);
String content = jobDataList.toJSON();
/* execute + test @formatter:off */
this.mockMvc.perform(put(apiEndpoint, PROJECT1_ID).contentType(MediaType.APPLICATION_JSON_VALUE).content(content)).andExpect(status().isOk()).andDo(defineRestService().with().useCaseData(useCase).tag(RestDocFactory.extractTag(apiEndpoint)).requestSchema(OpenApiSchema.FALSE_POSITVES_FOR_JOB.getSchema()).and().document(requestFields(fieldWithPath(PROPERTY_API_VERSION).description("The api version, currently only 1.0 is supported"), fieldWithPath(PROPERTY_TYPE).description("The type of the json content. Currently only accepted value is '" + FalsePositiveJobDataList.ACCEPTED_TYPE + "'."), fieldWithPath(PROPERTY_JOBDATA).description("Job data list containing false positive setup based on former jobs"), fieldWithPath(PROPERTY_JOBDATA + "[]." + PROPERTY_JOBUUID).description("SecHub job uuid where finding was"), fieldWithPath(PROPERTY_JOBDATA + "[]." + PROPERTY_FINDINGID).description("SecHub finding identifier - identifies problem inside the job which shall be markeda as a false positive. *ATTENTION*: at the moment only code scan false positive handling is supported. Infra and web scan findings will lead to a non accepted error!"), fieldWithPath(PROPERTY_JOBDATA + "[]." + PROPERTY_COMMENT).optional().description("A comment describing why this is a false positive")), pathParameters(parameterWithName(PROJECT_ID.paramName()).description("The projectId of the project where users adds false positives for"))));
/* @formatter:on */
}
Aggregations