Skip to content

Commit

Permalink
test(yarn): Removed unnecessary try-catch.
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeMathews committed Apr 21, 2020
1 parent 08791ea commit 3cf950b
Showing 1 changed file with 4 additions and 9 deletions.
Expand Up @@ -38,15 +38,10 @@ void doesntThrowOnMissingExternalId() throws MissingExternalIdException {
final List<YarnLockEntry> yarnLockEntries = Collections.singletonList(new YarnLockEntry(validYarnLockEntryIds, "1.0", validYarnLockDependencies));
final YarnLock yarnLock = new YarnLock(yarnLockEntries);

DependencyGraph dependencyGraph = null;
try {
dependencyGraph = yarnTransformer.transform(packageJson, yarnLock, false);
} catch (final MissingExternalIdException missingExternalIdException) {
// Not using Assertions.assetDoesNotThrow so we can re-use the dependency graph for the sanity check below.
Assertions.fail("MissingExternalIdException should not have been thrown.", missingExternalIdException);
}

// Sanity check
// This should not throw an exception.
final DependencyGraph dependencyGraph = yarnTransformer.transform(packageJson, yarnLock, false);

// Sanity check.
Assertions.assertNotNull(dependencyGraph, "The dependency graph should not be null.");
Assertions.assertEquals(1, dependencyGraph.getRootDependencies().size(), "Only 'foo:1.0' should appear in the graph.");
final ExternalId fooExternalId = externalIdFactory.createNameVersionExternalId(Forge.NPMJS, "foo", "1.0");
Expand Down

0 comments on commit 3cf950b

Please sign in to comment.