@SuppressWarnings({ "serial" }) @Test public void testApplyParameters(){ Swagger swagger = new Swagger(); Reader.read(swagger, new HashMap<Class<?>, Object>(){{ put(InterfaceServiceTest.class, new InterfaceServiceImplTest()); }}, "/h"); Map<String, Path> paths = swagger.getPaths(); Assert.assertEquals(paths.size(), 4); Path path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/test"); Assert.assertNotNull(path); Operation operation = path.getOperationMap().get(HttpMethod.POST); Assert.assertNotNull(operation); Assert.assertNotNull(operation.getParameters()); Assert.assertEquals(operation.getSummary(), "查询用户"); List<Parameter> parameters = operation.getParameters(); Assert.assertEquals(parameters.get(0).getName(), "para"); Assert.assertEquals(parameters.get(1).getName(), "code"); Assert.assertTrue(parameters.get(0).getRequired()); Assert.assertEquals(parameters.get(0).getDescription(), "参数"); path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/login/bypwd"); Assert.assertNotNull(path); path = swagger.getPaths().get("/h/com.deepoove.swagger.dubbo.api.InterfaceServiceTest/login"); Assert.assertNotNull(path); }
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); } }
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); } } }
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); }
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); }
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);  }