public static SetX<Class<?>> restResourceTags(String... classes){ return (SetX)SetX.fromIterable(concat(Stream.of(classes).map(cl -> toClass(cl)).collect(Collectors.toList()),defaultTags)); } public static SetX<Class<?>> restResourceTags(Class... classes){
@Test public void testRestResourceTagDefaults() { assertThat(RestResourceTagBuilder.restResourceTags("com.oath.micro.server.module.RestResourceTagBuilderTest"), hasItem( CommonRestResource.class)); } @Test
@Before public void setup(){ module = EmbeddedModule.annotationModule(restAnnotations(Anno.class),"test"); }
public static SetX<Class<? extends Annotation>> restAnnotations(String... classes){ return (SetX)SetX.fromIterable(concat(Stream.of(classes).map(cl -> toClass(cl)).collect(Collectors.toList()),defaultTags)); } public static SetX<Class<? extends Annotation>> restAnnotations(Class<? extends Annotation>... classes){
@Test public void testRestResourceTag() { assertThat(RestResourceTagBuilder.restResourceTags("com.oath.micro.server.module.RestResourceTagBuilderTest"), hasItem( RestResourceTagBuilderTest.class)); } @Test
public static SetX<Class<? extends Annotation>> restAnnotations(String... classes){ return (SetX)SetX.fromIterable(concat(Stream.of(classes).map(cl -> toClass(cl)).collect(Collectors.toList()),defaultTags)); } public static SetX<Class<? extends Annotation>> restAnnotations(Class<? extends Annotation>... classes){
@Test public void testRestResourceTagClasses() { assertThat(RestResourceTagBuilder.restResourceTags(RestResourceTagBuilderTest.class), hasItem( RestResourceTagBuilderTest.class)); } @Test
public static SetX<Class<?>> restResourceTags(String... classes){ return (SetX)SetX.fromIterable(concat(Stream.of(classes).map(cl -> toClass(cl)).collect(Collectors.toList()),defaultTags)); } public static SetX<Class<?>> restResourceTags(Class... classes){
@Test public void testRestResourceTagClassesDefaults() { assertThat(RestResourceTagBuilder.restResourceTags(RestResourceTagBuilderTest.class), hasItem( CommonRestResource.class)); }
@Test(expected=ClassNotFoundException.class) public void testRestResourceTagNonsense() { RestResourceTagBuilder.restResourceTags("com.oath.micro.server.module.RestResourceTagBuilderTest","nonsense"); fail("should not get here, ClassNotFound expected"); } @Test
@Before public void setup(){ module = ConfigurableModule.builder() .restResourceClasses(restResourceTags(ModuleDataExtractorTest.class)) .context("test") .servlets(HashMapBuilder.of("/*1",new BasicServlet())) .filters(HashMapBuilder.of("/*",new BasicFilter())) .build(); extractor = new ModuleDataExtractor(module); rootContext = mock(AnnotationConfigWebApplicationContext.class); data = ServerData.builder().resources(LinkedListX.of()).module(module).build(); }