@Test public void testProcessResponse(@Injectable final Schema responseSchema, @Injectable final Header responseHeader) throws Exception { new StrictExpectations(){{ new SchemaProcessor(cache, swagger); times=1; result = propertyProcessor; new HeaderProcessor(cache,swagger); times = 1; result = headerProcessor; new LinkProcessor(cache,swagger); times = 1; result = linkProcessor; propertyProcessor.processSchema(responseSchema); times=1; headerProcessor.processHeader(responseHeader); times = 1; }}; ApiResponse response = new ApiResponse(); response.content(new Content().addMediaType("*/*", new MediaType().schema(responseSchema))); response.addHeaderObject("foo", responseHeader); new ResponseProcessor(cache, swagger).processResponse(response); new FullVerifications(){{}}; }
public void processResponse(ApiResponse response) { if (response.get$ref() != null){ processReferenceResponse(response); } Schema schema = null; if(response.getContent() != null){ Map<String,MediaType> content = response.getContent(); for( String mediaName : content.keySet()) { MediaType mediaType = content.get(mediaName); if(mediaType.getSchema()!= null) { schema = mediaType.getSchema(); if (schema != null) { schemaProcessor.processSchema(schema); } } if(mediaType.getExamples() != null) { for(Example ex: mediaType.getExamples().values()){ exampleProcessor.processExample(ex); } } } } if (response.getHeaders() != null){ Map<String,Header> headers = response.getHeaders(); for(String headerName : headers.keySet()){ Header header = headers.get(headerName); headerProcessor.processHeader(header); } } if (response.getLinks() != null){ Map<String,Link> links = response.getLinks(); for(String linkName : links.keySet()){ Link link = links.get(linkName); linkProcessor.processLink(link); } } }
ResponseProcessor { public void processResponse(ApiResponse response) { if (response.get$ref() != null){ processReferenceResponse(response); } Schema schema = null; if(response.getContent() != null){ Map<String,MediaType> content = response.getContent(); for( String mediaName : content.keySet()) { MediaType mediaType = content.get(mediaName); if(mediaType.getSchema()!= null) { schema = mediaType.getSchema(); if (schema != null) { schemaProcessor.processSchema(schema); } } if(mediaType.getExamples() != null) { for(Example ex: mediaType.getExamples().values()){ exampleProcessor.processExample(ex); } } } } if (response.getHeaders() != null){ Map<String,Header> headers = response.getHeaders(); for(String headerName : headers.keySet()){ Header header = headers.get(headerName); headerProcessor.processHeader(header); } } if (response.getLinks() != null){ Map<String,Link> links = response.getLinks(); for(String linkName : links.keySet()){ Link link = links.get(linkName); linkProcessor.processLink(link); } } } }
ResponseProcessor { public void processResponse(ApiResponse response) { if (response.get$ref() != null){ processReferenceResponse(response); } Schema schema = null; if(response.getContent() != null){ Map<String,MediaType> content = response.getContent(); for( String mediaName : content.keySet()) { MediaType mediaType = content.get(mediaName); if(mediaType.getSchema()!= null) { schema = mediaType.getSchema(); if (schema != null) { schemaProcessor.processSchema(schema); } } if(mediaType.getExamples() != null) { for(Example ex: mediaType.getExamples().values()){ exampleProcessor.processExample(ex); } } } } if (response.getHeaders() != null){ Map<String,Header> headers = response.getHeaders(); for(String headerName : headers.keySet()){ Header header = headers.get(headerName); headerProcessor.processHeader(header); } } if (response.getLinks() != null){ Map<String,Link> links = response.getLinks(); for(String linkName : links.keySet()){ Link link = links.get(linkName); linkProcessor.processLink(link); } } } ResponseProcessor(ResolverCache cache, OpenAPI openAPI); }
ResponseProcessor { public void processResponse(ApiResponse response) { if (response.get$ref() != null){ processReferenceResponse(response); } Schema schema = null; if(response.getContent() != null){ Map<String,MediaType> content = response.getContent(); for( String mediaName : content.keySet()) { MediaType mediaType = content.get(mediaName); if(mediaType.getSchema()!= null) { schema = mediaType.getSchema(); if (schema != null) { schemaProcessor.processSchema(schema); } } if(mediaType.getExamples() != null) { for(Example ex: mediaType.getExamples().values()){ exampleProcessor.processExample(ex); } } } } if (response.getHeaders() != null){ Map<String,Header> headers = response.getHeaders(); for(String headerName : headers.keySet()){ Header header = headers.get(headerName); headerProcessor.processHeader(header); } } if (response.getLinks() != null){ Map<String,Link> links = response.getLinks(); for(String linkName : links.keySet()){ Link link = links.get(linkName); linkProcessor.processLink(link); } } } ResponseProcessor(ResolverCache cache, OpenAPI openAPI); void processResponse(ApiResponse response); void processReferenceResponse(ApiResponse response); }
ResponseProcessor { public void processResponse(ApiResponse response) { if (response.get$ref() != null){ processReferenceResponse(response); } Schema schema = null; if(response.getContent() != null){ Map<String,MediaType> content = response.getContent(); for( String mediaName : content.keySet()) { MediaType mediaType = content.get(mediaName); if(mediaType.getSchema()!= null) { schema = mediaType.getSchema(); if (schema != null) { schemaProcessor.processSchema(schema); } } if(mediaType.getExamples() != null) { for(Example ex: mediaType.getExamples().values()){ exampleProcessor.processExample(ex); } } } } if (response.getHeaders() != null){ Map<String,Header> headers = response.getHeaders(); for(String headerName : headers.keySet()){ Header header = headers.get(headerName); headerProcessor.processHeader(header); } } if (response.getLinks() != null){ Map<String,Link> links = response.getLinks(); for(String linkName : links.keySet()){ Link link = links.get(linkName); linkProcessor.processLink(link); } } } ResponseProcessor(ResolverCache cache, OpenAPI openAPI); void processResponse(ApiResponse response); void processReferenceResponse(ApiResponse response);  }