use of com.mercedesbenz.sechub.domain.scan.product.ReportProductExecutionService in project sechub by mercedes-benz.
the class ReportServiceTest method before.
@Before
public void before() throws Exception {
serviceToTest = new CreateScanReportService();
secHubJobUUID = UUID.randomUUID();
context = mock(SecHubExecutionContext.class);
configuration = mock(SecHubConfiguration.class);
when(context.getConfiguration()).thenReturn(configuration);
when(context.getSechubJobUUID()).thenReturn(secHubJobUUID);
when(configuration.getProjectId()).thenReturn("project1");
reportRepository = mock(ScanReportRepository.class);
/* just return report as given to save method... */
when(reportRepository.save(any(ScanReport.class))).thenAnswer(new Answer<ScanReport>() {
@Override
public ScanReport answer(InvocationOnMock invocation) throws Throwable {
return (ScanReport) invocation.getArguments()[0];
}
});
scanReportTransactionService = mock(ScanReportTransactionService.class);
reportProductExecutionService = mock(ReportProductExecutionService.class);
reportTransformationResult = mock(ReportTransformationResult.class);
SecHubResult sechubResult = mock(SecHubResult.class);
when(reportTransformationResult.getResult()).thenReturn(sechubResult);
secHubResultService = mock(SecHubReportProductTransformerService.class);
when(secHubResultService.createResult(context)).thenReturn(reportTransformationResult);
trafficLightCalculator = mock(ScanReportTrafficLightCalculator.class);
serviceToTest.reportProductExecutionService = reportProductExecutionService;
serviceToTest.reportTransformerService = secHubResultService;
serviceToTest.trafficLightCalculator = trafficLightCalculator;
serviceToTest.reportRepository = reportRepository;
serviceToTest.scanReportTransactionService = scanReportTransactionService;
}
Aggregations