예제 #1
0
 public void testIgnoreSubPackages() throws Exception {
   MarkedClassFinder markedClassFinder =
       new MarkedClassFinder(TestMarker.class, "org.givwenzen.annotations.middle.");
   Set<MarkedClass> classes = markedClassFinder.findMarkedClasses();
   assertTrue(classes.contains(new MarkedClass(MarkedClassX.class)));
   assertTrue(classes.contains(new MarkedClass(MarkedClassY.class)));
   assertEquals(2, classes.size());
 }
예제 #2
0
 public void testSupportMultiplePackages() throws Exception {
   MarkedClassFinder markedClassFinder =
       new MarkedClassFinder(
           TestMarker.class,
           "org.givwenzen.annotations.left.,"
               + "org.givwenzen.annotations.middle.,"
               + "org.givwenzen.annotations.right.");
   Set<MarkedClass> classes = markedClassFinder.findMarkedClasses();
   assertTrue(classes.contains(new MarkedClass(MarkedClassA.class)));
   assertTrue(classes.contains(new MarkedClass(MarkedClassB.class)));
   assertTrue(classes.contains(new MarkedClass(MarkedClassX.class)));
   assertTrue(classes.contains(new MarkedClass(MarkedClassY.class)));
   assertEquals(4, classes.size());
 }
예제 #3
0
  public void testSubpackagesNotSpecifiedAreStillSearched() throws Exception {
    MarkedClassFinder markedClassFinder =
        new MarkedClassFinder(TestMarker.class, "org.givwenzen.annotations.left.");
    Set<MarkedClass> classes = markedClassFinder.findMarkedClasses();
    assertTrue(classes.contains(new MarkedClass(MarkedClassA.class)));
    assertFalse(classes.contains(new MarkedClass(MarkedClassB.class)));
    assertEquals(1, classes.size());

    markedClassFinder = new MarkedClassFinder(TestMarker.class, "org.givwenzen.annotations.right.");
    classes = markedClassFinder.findMarkedClasses();
    assertTrue(classes.contains(new MarkedClass(MarkedClassB.class)));
    assertFalse(classes.contains(new MarkedClass(MarkedClassA.class)));
    assertEquals(1, classes.size());
  }
예제 #4
0
 public void testFindClassWithMarkerAnnotationWithNoType() throws Exception {
   MarkedClassFinder markedClassFinder =
       new MarkedClassFinder(TestMarker.class, "org.givwenzen.annotations.");
   assertTrue(
       markedClassFinder.findMarkedClasses().contains(new MarkedClass(MyMarkedClass.class)));
 }