use of io.swagger.jaxrs.config.DefaultJaxrsScanner in project swagger-core by swagger-api.
the class SwaggerContextServiceTest method initMock.
@BeforeMethod
void initMock() {
servletContext1 = mock(ServletContext.class);
servletConfig1 = mock(ServletConfig.class);
servletContext2 = mock(ServletContext.class);
servletConfig2 = mock(ServletConfig.class);
jaxrsScanner = new DefaultJaxrsScanner();
BeanConfig bc = new BeanConfig();
bc.setDescription("Bean Config test 1");
beanConfigScanner1 = bc;
bc = new BeanConfig();
bc.setDescription("Bean Config test 2");
beanConfigScanner2 = bc;
}
use of io.swagger.jaxrs.config.DefaultJaxrsScanner in project swagger-core by swagger-api.
the class DefaultJaxrsScannerTest method classesFromContextTest.
@Test(description = "should return singletones")
public void classesFromContextTest() {
Application app = mock(Application.class);
Set<Object> singletons = Sets.newHashSet(new io.swagger.jaxrs.listing.ApiListingResource(), new DefaultJaxrsScannerTest());
when(app.getClasses()).thenReturn(null);
when(app.getSingletons()).thenReturn(singletons);
DefaultJaxrsScanner scanner = new DefaultJaxrsScanner();
Set<Class<?>> output = scanner.classesFromContext(app, null);
Set<Class<?>> classes = Sets.newHashSet(Iterables.transform(singletons, new Function<Object, Class<?>>() {
@Override
public Class<?> apply(Object o) {
return o.getClass();
}
}));
assertEquals(output, classes);
}
Aggregations