Search in sources :

Example 1 with DartPubDepDetectable

use of com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable 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);
}
Also used : FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) DetectableResult(com.synopsys.integration.detectable.detectable.result.DetectableResult) FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) File(java.io.File) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) DartPubDepDetectable(com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable) Test(org.junit.jupiter.api.Test)

Example 2 with DartPubDepDetectable

use of com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable in project synopsys-detect by blackducksoftware.

the class DetectableFactory method createDartPubDepDetectable.

public DartPubDepDetectable createDartPubDepDetectable(DetectableEnvironment environment, DartPubDepsDetectableOptions dartPubDepsDetectableOptions, DartResolver dartResolver, FlutterResolver flutterResolver) {
    PubDepsParser pubDepsParser = new PubDepsParser();
    PubSpecYamlNameVersionParser pubSpecYamlNameVersionParser = new PubSpecYamlNameVersionParser();
    PubDepsExtractor pubDepsExtractor = new PubDepsExtractor(executableRunner, pubDepsParser, pubSpecYamlNameVersionParser, toolVersionLogger);
    return new DartPubDepDetectable(environment, fileFinder, pubDepsExtractor, dartPubDepsDetectableOptions, dartResolver, flutterResolver);
}
Also used : PubDepsParser(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser) PubSpecYamlNameVersionParser(com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser) PubDepsExtractor(com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsExtractor) DartPubDepDetectable(com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable)

Aggregations

DartPubDepDetectable (com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable)2 FileFinder (com.synopsys.integration.common.util.finder.FileFinder)1 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)1 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)1 FileNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult)1 PubSpecYamlNameVersionParser (com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser)1 PubDepsExtractor (com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsExtractor)1 PubDepsParser (com.synopsys.integration.detectable.detectables.dart.pubdep.PubDepsParser)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1