@Test public void testReadWrongFile() { try { dependencyReader.readDependencies(null); fail("reading not existing file should fail"); } catch(NullPointerException e) { assertThat(e.getMessage(), is("Class could not be read")); } }
public Node readDependencies(byte[] classAsBytes) { checkNotNull(classAsBytes, "Class could not be read"); DependencyClassVisitor visitor = new DependencyClassVisitor(dependencyGraph, collapseInnerClasses); ClassReader reader = new ClassReader(classAsBytes); reader.accept(visitor, 0); return dependencyGraph.getNode(visitor.getClassName()); }
DependencyReader { public Node readDependencies(byte[] classAsBytes) { checkNotNull(classAsBytes, "Class could not be read"); DependencyClassVisitor visitor = new DependencyClassVisitor(dependencyGraph, collapseInnerClasses); ClassReader reader = new ClassReader(classAsBytes); reader.accept(visitor, 0); return dependencyGraph.getNode(visitor.getClassName()); } }
DependencyReader { public Node readDependencies(byte[] classAsBytes) { checkNotNull(classAsBytes, "Class could not be read"); DependencyClassVisitor visitor = new DependencyClassVisitor(dependencyGraph, collapseInnerClasses); ClassReader reader = new ClassReader(classAsBytes); reader.accept(visitor, 0); return dependencyGraph.getNode(visitor.getClassName()); } DependencyReader(DependencyGraph dependencyGraph, boolean collapseInnerClasses); }
DependencyReader { public Node readDependencies(byte[] classAsBytes) { checkNotNull(classAsBytes, "Class could not be read"); DependencyClassVisitor visitor = new DependencyClassVisitor(dependencyGraph, collapseInnerClasses); ClassReader reader = new ClassReader(classAsBytes); reader.accept(visitor, 0); return dependencyGraph.getNode(visitor.getClassName()); } DependencyReader(DependencyGraph dependencyGraph, boolean collapseInnerClasses); Node readDependencies(byte[] classAsBytes); }
DependencyReader { public Node readDependencies(byte[] classAsBytes) { checkNotNull(classAsBytes, "Class could not be read"); DependencyClassVisitor visitor = new DependencyClassVisitor(dependencyGraph, collapseInnerClasses); ClassReader reader = new ClassReader(classAsBytes); reader.accept(visitor, 0); return dependencyGraph.getNode(visitor.getClassName()); } DependencyReader(DependencyGraph dependencyGraph, boolean collapseInnerClasses); Node readDependencies(byte[] classAsBytes);  }