예제 #1
0
 private JavaClass findClass(String classname) {
   for (JavaClass jClass : graph.vertexSet()) {
     if (jClass.getName().equals(classname)) {
       return jClass;
     }
   }
   return null;
 }
예제 #2
0
 public Set<String> getIndexedClasses() {
   Set<String> classes = newHashSet();
   Set<JavaClass> vertexSet = graph.vertexSet();
   for (JavaClass each : vertexSet) {
     classes.add(each.getName());
   }
   return classes;
 }
  @Test
  public void shouldReturnUnparsableClassIfClassCannotBeFound() {
    JavaClass javaClass = builder.createClass("foo.bar.com");

    assertThat(javaClass).isInstanceOf(UnparsableClass.class);
    assertThat(javaClass.getName()).isEqualTo("foo.bar.com");
    assertThat(javaClass.getImports()).isEmpty();
  }
  @Test
  public void shouldLookForClassesInTargetDirectories() throws Exception {
    newDir = new File("tempClassDir");
    List<File> buildPaths = asList(newDir);
    ClasspathProvider classpath =
        new StandaloneClasspath(
            buildPaths,
            FakeEnvironments.systemClasspath() + pathSeparator + newDir.getAbsolutePath());

    String classname = "org.fakeco.Foobar";
    createClass(classname);

    builder = new JavaClassBuilder(classpath);
    JavaClass javaClass = builder.createClass(classname);
    assertEquals(classname, javaClass.getName());
    assertFalse(javaClass.isATest());
  }