javax.annotation.Resources Java Examples

The following examples show how to use javax.annotation.Resources. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClasspathScannerTest.java    From dolphin-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testScanOtherPackage() {
    //There can't be a class that is annotated with Inject
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN);
    Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);

    classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);

    classes = scanner.getTypesAnnotatedWith(Documented.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 1);
    assertTrue(classes.contains(DocumentAnnotatedClass.class));
}
 
Example #2
Source File: ClasspathScannerTest.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void testSimpleScan() {
    //There can't be a class that is annotated with Inject
    final ServerConfiguration defaultPlatformConfiguration = ConfigurationFileLoader.loadConfiguration();
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner(defaultPlatformConfiguration.getListProperty(ROOT_PACKAGE_FOR_CLASSPATH_SCAN));
    Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);

    classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 1);
    assertTrue(classes.contains(AnnotatedClassForClasspathScan.class));
}