Search in sources :

Example 6 with YarnLockEntryBuilder

use of com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryBuilder in project synopsys-detect by blackducksoftware.

the class YarnLockHeaderSectionParserTest method testQuotedList.

@Test
void testQuotedList() {
    String line = "\"color-convert@npm:^1.9.0, color-convert@npm:^1.9.1\":";
    List<String> lines = Arrays.asList(line);
    Assertions.assertTrue(yarnLockParser.applies(line));
    YarnLockEntryBuilder builder = new YarnLockEntryBuilder();
    yarnLockParser.parseSection(builder, lines, 0);
    // Complete the builder requirements and build the entry
    builder.setVersion("testVersion");
    YarnLockEntry entry = builder.build();
    List<YarnLockEntryId> ids = entry.getIds();
    Assertions.assertEquals(2, ids.size());
    Assertions.assertEquals("color-convert", ids.get(0).getName());
    Assertions.assertEquals("^1.9.0", ids.get(0).getVersion());
    Assertions.assertEquals("color-convert", ids.get(1).getName());
    Assertions.assertEquals("^1.9.1", ids.get(1).getVersion());
}
Also used : YarnLockEntryId(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryId) YarnLockEntry(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntry) YarnLockEntryBuilder(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

YarnLockEntry (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntry)6 YarnLockEntryBuilder (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryBuilder)6 YarnLockEntryId (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryId)6 Test (org.junit.jupiter.api.Test)5