use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testPreferredDetectorMissingSuccess.
@Test
public void testPreferredDetectorMissingSuccess() throws DetectableException, ExecutableFailedException {
Extraction extraction = createSuccessExtraction();
DetectableResult extractionResult = new PassedDetectableResult();
String projectBomTool = "testBomTool";
DetectorToolResult result = executeToolTest(extraction, extractionResult, projectBomTool);
assertFalse(result.getApplicableDetectorTypes().isEmpty());
assertTrue(result.getBomToolCodeLocations().isEmpty());
assertTrue(result.getBomToolProjectNameVersion().isPresent());
assertTrue(result.getCodeLocationMap().isEmpty());
assertTrue(result.getFailedDetectorTypes().isEmpty());
assertTrue(result.getRootDetectorEvaluationTree().isPresent());
}
use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testExtractionFailed.
@Test
public void testExtractionFailed() throws DetectableException, ExecutableFailedException {
Extraction extraction = createFailExtraction();
DetectableResult extractionResult = new PassedDetectableResult();
String projectBomTool = DetectorType.GO_MOD.name();
DetectorToolResult result = executeToolTest(extraction, extractionResult, projectBomTool);
assertFalse(result.getApplicableDetectorTypes().isEmpty());
assertTrue(result.getBomToolCodeLocations().isEmpty());
assertFalse(result.getBomToolProjectNameVersion().isPresent());
assertTrue(result.getCodeLocationMap().isEmpty());
assertTrue(result.getFailedDetectorTypes().isEmpty());
assertTrue(result.getRootDetectorEvaluationTree().isPresent());
}
use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method createDetectable.
private GoModCliDetectable createDetectable(Extraction extraction, DetectableResult extractionResult) throws DetectableException, ExecutableFailedException {
File relevantFile = new File("go.mod");
List<File> relevantFiles = Collections.singletonList(relevantFile);
GoModCliDetectable detectable = Mockito.mock(GoModCliDetectable.class);
Mockito.when(detectable.extractable()).thenReturn(extractionResult);
Mockito.when(detectable.applicable()).thenReturn(new PassedDetectableResult(Collections.emptyList(), relevantFiles));
Mockito.when(detectable.extract(Mockito.any())).thenReturn(extraction);
return detectable;
}
use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.
the class DetectorToolTest method testSuccess.
@Test
public void testSuccess() throws DetectableException, ExecutableFailedException {
Extraction extraction = createSuccessExtraction();
DetectableResult extractionResult = new PassedDetectableResult();
String projectBomTool = DetectorType.GO_MOD.name();
DetectorToolResult result = executeToolTest(extraction, extractionResult, projectBomTool);
assertFalse(result.getApplicableDetectorTypes().isEmpty());
assertTrue(result.getBomToolCodeLocations().isEmpty());
assertTrue(result.getBomToolProjectNameVersion().isPresent());
assertTrue(result.getCodeLocationMap().isEmpty());
assertTrue(result.getFailedDetectorTypes().isEmpty());
assertTrue(result.getRootDetectorEvaluationTree().isPresent());
}
Aggregations