use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.
the class DartPubDepDetectable method extractable.
@Override
public DetectableResult extractable() throws DetectableException {
if (!pubspecLock.isPresent() && pubspecYaml.isPresent()) {
return new PubSpecLockNotFoundDetectableResult(environment.getDirectory().getAbsolutePath());
} else if (pubspecLock.isPresent() && !pubspecYaml.isPresent()) {
return new FileNotFoundDetectableResult(PUBSPEC_LOCK_FILENAME);
}
dartExe = dartResolver.resolveDart();
flutterExe = flutterResolver.resolveFlutter();
if (dartExe == null && flutterExe == null) {
return new ExecutablesNotFoundDetectableResult(Arrays.asList("dart", "flutter"));
}
return new PassedDetectableResult();
}
use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.
the class PubDepsDetectableTest method testThrowExceptionWhenLockFilePresentButNotYaml.
@Test
public void testThrowExceptionWhenLockFilePresentButNotYaml() throws DetectableException {
FileFinder fileFinder = Mockito.mock(FileFinder.class);
Mockito.when(fileFinder.findFile(null, "pubspec.yaml")).thenReturn(null);
Mockito.when(fileFinder.findFile(null, "pubspec.lock")).thenReturn(new File(""));
DartPubDepDetectable dartPubDepDetectable = new DartPubDepDetectable(new DetectableEnvironment(null), fileFinder, null, null, null, null);
DetectableResult applicable = dartPubDepDetectable.applicable();
Assertions.assertTrue(applicable.getPassed());
DetectableResult extractable = dartPubDepDetectable.extractable();
Assertions.assertTrue(extractable instanceof FileNotFoundDetectableResult);
}
use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.
the class ConanCliDetectable method applicable.
@Override
public DetectableResult applicable() {
PassedResultBuilder passedResultBuilder = new PassedResultBuilder();
File conanTxtFile = fileFinder.findFile(environment.getDirectory(), CONANFILETXT);
if (conanTxtFile == null) {
File conanPyFile = fileFinder.findFile(environment.getDirectory(), CONANFILEPY);
if (conanPyFile == null) {
return new FileNotFoundDetectableResult(CONANFILETXT);
} else {
passedResultBuilder.foundFile(conanPyFile);
}
} else {
passedResultBuilder.foundFile(conanTxtFile);
}
return passedResultBuilder.build();
}
Aggregations