ResponseModelData { public List<ModelDetail> createModelList(Swagger swagger) { Map<String, Model> modelMap = swagger.getDefinitions(); List<ModelDetail> modelDetailsList = new ArrayList<>(); for (Map.Entry<String, Model> entry : modelMap.entrySet()) { ModelDetail modelDetail = createModel(entry); modelDetailsList.add(modelDetail); } return modelDetailsList; }  @SuppressWarnings("unchecked") //Remove JSONObject untyped warnings Map<String, JSONObject> createResponseJsonSchema(Swagger swagger); List<ModelDetail> createModelList(Swagger swagger); String createModelTemplate(Swagger swagger); void buildResponseModelPage(Swagger swagger);  }
@Test public void testCreateModelList() { ResponseModelData responseModelData = new ResponseModelData(); List<ModelDetail> modelList = responseModelData.createModelList(swagger); Set<String> expectedTitles = swagger.getDefinitions().keySet(); for(ModelDetail md : modelList){ String actualTitle = md.getModelTitle(); assertTrue(expectedTitles.contains(actualTitle)); } int extremeSearchResultIndex = 2; int destinationModelParamIndex= 0; ModelDetail modelDetail = modelList.get(extremeSearchResultIndex); ModelParameter modelParameterForExtremeSearchResult = modelDetail.getModelParameterList().get(destinationModelParamIndex); assertEquals("destination", modelParameterForExtremeSearchResult.getName()); assertThat(modelParameterForExtremeSearchResult.getDescription(),containsString("city or airport")); assertEquals("string", modelParameterForExtremeSearchResult.getType()); int lowFareSearchIndex = 3; int resultsModelParamIndex = 1; ModelDetail modelDetailForLowFareSearch = modelList.get(lowFareSearchIndex); ModelParameter modelParameterForResults = modelDetailForLowFareSearch.getModelParameterList().get(resultsModelParamIndex); assertEquals("results", modelParameterForResults.getName()); assertEquals("array", modelParameterForResults.getType()); assertEquals("LowFareSearchResult", modelParameterForResults.getReferenceModel()); }