Skip to content

Commit

Permalink
closes #36
Browse files Browse the repository at this point in the history
- added test checking whether we properly keep info about containing
jars if a class is contained in more than one jar
  • Loading branch information
ayld committed Dec 16, 2017
1 parent 1e30dca commit aeb435a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class TestModeShapeLibraryIndex {
private DependencyResolver<ClassStream> classStreamResolver;

private JarFile primefacesJar;
private JarFile primefacesJarCopy;
private JarFile aspectweaverJar;

@Before
Expand All @@ -55,6 +56,9 @@ public void init() throws URISyntaxException, IOException {
this.primefacesJar = new JarFile(Resources.getResource("test-classes/lib/primefaces-3.5.jar").toURI().getPath());
toIndex.add(primefacesJar);

this.primefacesJarCopy = new JarFile(Resources.getResource("test-classes/lib/primefaces-3.5_copy.jar").toURI().getPath());
toIndex.add(primefacesJarCopy);

modeShapeIndex.index(toIndex);
}

Expand Down Expand Up @@ -99,6 +103,11 @@ public void find() throws IOException {
assertEquals(found.name(), testName);
assertTrue(found.content().available() > 0);

final Set<String> jarNamesContainingFoundClass = found.containedIn();
assertFalse(found.containedIn().isEmpty());
assertTrue(jarNamesContainingFoundClass.contains(primefacesJar.getName()));
assertTrue(jarNamesContainingFoundClass.contains(primefacesJarCopy.getName()));

testName = new ClassName("org.primefaces.facelets.MethodRule$MethodBindingMetadata");
found = modeShapeIndex.find(testName);

Expand Down Expand Up @@ -152,7 +161,6 @@ public void get() throws IOException {
@Test
public void size() {
final long size = modeShapeIndex.size();

assertTrue(size > 0);
}
}
1 change: 0 additions & 1 deletion src/test/java/org/codarama/diet/model/TestClassFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public void valid() {
@Test
public void dependencies() {
final Set<ClassName> dependencies = ClassFile.fromClasspath("test-classes/ClassName.class").dependencies();

Assert.assertTrue(dependencies != null);

final int expectedCount = 2;
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/codarama/diet/model/TestClassStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ public void creation() throws FileNotFoundException {
Assert.assertNotNull(dependencies);
Assert.assertTrue(dependencies.size() > 0);
}

}
Binary file not shown.

0 comments on commit aeb435a

Please sign in to comment.