Search in sources :

Example 1 with NpmDependencyType

use of com.synopsys.integration.detectable.detectables.npm.NpmDependencyType in project synopsys-detect by blackducksoftware.

the class NpmPackageJsonParseDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableEnvironment environment = MockDetectableEnvironment.empty();
    FileFinder fileFinder = MockFileFinder.withFileNamed(PACKAGE_JSON_FILENAME);
    EnumListFilter<NpmDependencyType> npmDependencyTypeFilter = EnumListFilter.fromExcluded(NpmDependencyType.DEV, NpmDependencyType.PEER);
    NpmPackageJsonParseDetectableOptions npmPackageJsonParseDetectableOptions = new NpmPackageJsonParseDetectableOptions(npmDependencyTypeFilter);
    NpmPackageJsonParseDetectable detectable = new NpmPackageJsonParseDetectable(environment, fileFinder, null);
    assertTrue(detectable.applicable().getPassed());
}
Also used : NpmPackageJsonParseDetectableOptions(com.synopsys.integration.detectable.detectables.npm.packagejson.NpmPackageJsonParseDetectableOptions) MockFileFinder(com.synopsys.integration.detectable.util.MockFileFinder) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) NpmDependencyType(com.synopsys.integration.detectable.detectables.npm.NpmDependencyType) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) MockDetectableEnvironment(com.synopsys.integration.detectable.util.MockDetectableEnvironment) NpmPackageJsonParseDetectable(com.synopsys.integration.detectable.detectables.npm.packagejson.NpmPackageJsonParseDetectable) Test(org.junit.jupiter.api.Test)

Example 2 with NpmDependencyType

use of com.synopsys.integration.detectable.detectables.npm.NpmDependencyType in project synopsys-detect by blackducksoftware.

the class PackageJsonExtractorTest method createExtractor.

private PackageJsonExtractor createExtractor(NpmDependencyType... excludedTypes) {
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    EnumListFilter<NpmDependencyType> npmDependencyTypeFilter = EnumListFilter.fromExcluded(excludedTypes);
    return new PackageJsonExtractor(gson, new ExternalIdFactory(), npmDependencyTypeFilter);
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) PackageJsonExtractor(com.synopsys.integration.detectable.detectables.npm.packagejson.PackageJsonExtractor) Gson(com.google.gson.Gson) NpmDependencyType(com.synopsys.integration.detectable.detectables.npm.NpmDependencyType)

Example 3 with NpmDependencyType

use of com.synopsys.integration.detectable.detectables.npm.NpmDependencyType in project synopsys-detect by blackducksoftware.

the class PackageJsonExtractorFunctionalTest method createExtractor.

private PackageJsonExtractor createExtractor(NpmDependencyType... excludedTypes) {
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    EnumListFilter<NpmDependencyType> npmDependencyTypeFilter = EnumListFilter.fromExcluded(excludedTypes);
    return new PackageJsonExtractor(gson, new ExternalIdFactory(), npmDependencyTypeFilter);
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) PackageJsonExtractor(com.synopsys.integration.detectable.detectables.npm.packagejson.PackageJsonExtractor) Gson(com.google.gson.Gson) NpmDependencyType(com.synopsys.integration.detectable.detectables.npm.NpmDependencyType)

Aggregations

NpmDependencyType (com.synopsys.integration.detectable.detectables.npm.NpmDependencyType)3 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)2 PackageJsonExtractor (com.synopsys.integration.detectable.detectables.npm.packagejson.PackageJsonExtractor)2 FileFinder (com.synopsys.integration.common.util.finder.FileFinder)1 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)1 NpmPackageJsonParseDetectable (com.synopsys.integration.detectable.detectables.npm.packagejson.NpmPackageJsonParseDetectable)1 NpmPackageJsonParseDetectableOptions (com.synopsys.integration.detectable.detectables.npm.packagejson.NpmPackageJsonParseDetectableOptions)1 MockDetectableEnvironment (com.synopsys.integration.detectable.util.MockDetectableEnvironment)1 MockFileFinder (com.synopsys.integration.detectable.util.MockFileFinder)1 Test (org.junit.jupiter.api.Test)1