Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<Parameter>()); reader.read(context); } } private  Reader(Swagger swagger); static void read(Swagger swagger, Set<Class<?>> classes); static void read(Swagger swagger, Map<Class<?>, Object> interfaceMapRef,
                            String httpContext);  }
@Test public void testRead() { Map<Class<?>, Object> interfaceMapRef = new HashMap<>(); interfaceMapRef.put(TestSwaggerService.class, new TestSwaggerServiceImpl()); Swagger swagger = new Swagger(); swagger.setBasePath("/rest/"); Reader.read(swagger, interfaceMapRef, ""); Assert.assertEquals("2.0", swagger.getSwagger()); Assert.assertEquals("/rest/", swagger.getBasePath()); Map<String, Path> paths = swagger.getPaths(); Assert.assertEquals(TestSwaggerService.class.getMethods().length, paths.size()); Assert.assertTrue(paths.containsKey(COMPLEX)); List<Parameter> parameters = paths.get(COMPLEX).getPost().getParameters(); Assert.assertTrue(CommonUtils.isNotEmpty(parameters)); Parameter parameter = parameters.get(0); Assert.assertTrue(parameter instanceof BodyParameter); Model schema = ((BodyParameter) parameter).getSchema(); Assert.assertTrue(schema instanceof RefModel); String ref = ((RefModel) schema).get$ref(); Assert.assertEquals("#/definitions/ComplexPojo", ref); }