use of com.synopsys.integration.detector.evaluation.DetectorEvaluationOptions in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method executeToolTest.
private DetectorToolResult executeToolTest(Extraction extraction, DetectableResult extractionResult, String projectBomTool) throws DetectableException, ExecutableFailedException {
ExtractionEnvironmentProvider extractionEnvironmentProvider = Mockito.mock(ExtractionEnvironmentProvider.class);
DetectorFinder detectorFinder = Mockito.mock(DetectorFinder.class);
EventSystem eventSystem = Mockito.mock(EventSystem.class);
CodeLocationConverter codeLocationConverter = Mockito.mock(CodeLocationConverter.class);
DetectorIssuePublisher detectorIssuePublisher = Mockito.mock(DetectorIssuePublisher.class);
StatusEventPublisher statusEventPublisher = Mockito.mock(StatusEventPublisher.class);
ExitCodePublisher exitCodePublisher = Mockito.mock(ExitCodePublisher.class);
DetectorEventPublisher detectorEventPublisher = Mockito.mock(DetectorEventPublisher.class);
DetectorTool tool = new DetectorTool(detectorFinder, extractionEnvironmentProvider, eventSystem, codeLocationConverter, detectorIssuePublisher, statusEventPublisher, exitCodePublisher, detectorEventPublisher);
File directory = new File(".");
GoModCliDetectable detectable = createDetectable(extraction, extractionResult);
DetectorRule<GoModCliDetectable> rule = createRule(detectable);
DetectorRuleSet detectorRuleSet = createRuleSet(rule);
DetectorFinderOptions detectorFinderOptions = createFinderOptions();
DetectorEvaluationOptions evaluationOptions = createEvaluationOptions();
DetectorEvaluationTree evaluationTree = createEvaluationTree(extraction, extractionResult, directory, rule, detectorRuleSet);
Mockito.when(detectorFinder.findDetectors(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(Optional.of(evaluationTree));
return tool.performDetectors(directory, detectorRuleSet, detectorFinderOptions, evaluationOptions, projectBomTool, new ArrayList<>(), new SimpleFileFinder());
}
use of com.synopsys.integration.detector.evaluation.DetectorEvaluationOptions in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testFailWhenMisConfigured.
@Test
public void testFailWhenMisConfigured() throws DetectUserFriendlyException {
ExtractionEnvironmentProvider extractionEnvironmentProvider = Mockito.mock(ExtractionEnvironmentProvider.class);
DetectorFinder detectorFinder = Mockito.mock(DetectorFinder.class);
EventSystem eventSystem = Mockito.mock(EventSystem.class);
CodeLocationConverter codeLocationConverter = Mockito.mock(CodeLocationConverter.class);
DetectorIssuePublisher detectorIssuePublisher = Mockito.mock(DetectorIssuePublisher.class);
StatusEventPublisher statusEventPublisher = Mockito.mock(StatusEventPublisher.class);
ExitCodePublisher exitCodePublisher = Mockito.mock(ExitCodePublisher.class);
DetectorEventPublisher detectorEventPublisher = Mockito.mock(DetectorEventPublisher.class);
DetectorTool tool = new DetectorTool(detectorFinder, extractionEnvironmentProvider, eventSystem, codeLocationConverter, detectorIssuePublisher, statusEventPublisher, exitCodePublisher, detectorEventPublisher);
File directory = new File(".");
DetectorRuleSet detectorRuleSet = Mockito.mock(DetectorRuleSet.class);
DetectorFinderOptions detectorFinderOptions = Mockito.mock(DetectorFinderOptions.class);
DetectorEvaluationOptions evaluationOptions = Mockito.mock(DetectorEvaluationOptions.class);
String projectBomTool = "testBomTool";
tool.performDetectors(directory, detectorRuleSet, detectorFinderOptions, evaluationOptions, projectBomTool, new ArrayList<>(), new SimpleFileFinder());
Mockito.verify(exitCodePublisher).publishExitCode(Mockito.any(ExitCodeType.class), Mockito.anyString());
}
Aggregations