use of mockit.FullVerifications in project swagger-parser by swagger-api.
the class PropertyProcessorTest method testProcessRefProperty_ExternalRef.
@Test
public void testProcessRefProperty_ExternalRef() throws Exception {
expectCreationOfExternalRefProcessor();
final String ref = "http://my.company.com/path/to/file.json#/foo/bar";
final RefProperty refProperty = new RefProperty(ref);
expectCallToExternalRefProcessor(ref, RefFormat.URL, "bar");
new PropertyProcessor(cache, swagger).processProperty(refProperty);
new FullVerifications() {
{
}
};
assertEquals(refProperty.get$ref(), "#/definitions/bar");
}
use of mockit.FullVerifications in project swagger-parser by swagger-api.
the class PropertyProcessorTest method testProcessArrayProperty_ItemsIsRefProperty.
@Test
public void testProcessArrayProperty_ItemsIsRefProperty() throws Exception {
expectCreationOfExternalRefProcessor();
final String ref = "http://my.company.com/path/to/file.json#/foo/bar";
final RefProperty refProperty = new RefProperty(ref);
ArrayProperty arrayProperty = new ArrayProperty();
arrayProperty.setItems(refProperty);
expectCallToExternalRefProcessor(ref, RefFormat.URL, "bar");
new PropertyProcessor(cache, swagger).processProperty(arrayProperty);
new FullVerifications() {
{
}
};
assertEquals(((RefProperty) arrayProperty.getItems()).get$ref(), "#/definitions/bar");
}
use of mockit.FullVerifications in project swagger-parser by swagger-api.
the class OperationProcessorTest method testProcessOperation.
@Test
public void testProcessOperation(@Injectable final List<Parameter> inputParameterList, @Injectable final List<Parameter> outputParameterList, @Injectable final Response incomingResponse, @Injectable final Response resolvedResponse) throws Exception {
Operation operation = new Operation();
operation.setParameters(inputParameterList);
final String ref = "http://my.company.com/path/to/file.json#/foo/bar";
RefResponse refResponse = new RefResponse(ref);
operation.response(200, refResponse);
operation.response(400, incomingResponse);
new Expectations() {
{
new ParameterProcessor(cache, swagger);
times = 1;
result = parameterProcessor;
new ResponseProcessor(cache, swagger);
times = 1;
result = responseProcessor;
parameterProcessor.processParameters(inputParameterList);
times = 1;
result = outputParameterList;
cache.loadRef(ref, RefFormat.URL, Response.class);
times = 1;
result = resolvedResponse;
responseProcessor.processResponse(incomingResponse);
times = 1;
responseProcessor.processResponse(resolvedResponse);
times = 1;
}
};
new OperationProcessor(cache, swagger).processOperation(operation);
new FullVerifications() {
{
}
};
assertEquals(operation.getResponses().get("200"), resolvedResponse);
assertEquals(operation.getParameters(), outputParameterList);
}
use of mockit.FullVerifications in project swagger-parser by swagger-api.
the class PropertyProcessorTest method testProcessRefProperty_InternalRef.
@Test
public void testProcessRefProperty_InternalRef() throws Exception {
expectCreationOfExternalRefProcessor();
final String expectedRef = "#/definitions/foo";
final RefProperty property = new RefProperty(expectedRef);
new PropertyProcessor(cache, swagger).processProperty(property);
new FullVerifications() {
{
}
};
assertEquals(property.get$ref(), expectedRef);
}
use of mockit.FullVerifications in project swagger-parser by swagger-api.
the class PropertyProcessorTest method testProcessMapProperty_AdditionalPropertiesIsRefProperty.
@Test
public void testProcessMapProperty_AdditionalPropertiesIsRefProperty() throws Exception {
expectCreationOfExternalRefProcessor();
final String ref = "http://my.company.com/path/to/file.json#/foo/bar";
final RefProperty refProperty = new RefProperty(ref);
MapProperty mapProperty = new MapProperty();
mapProperty.setAdditionalProperties(refProperty);
expectCallToExternalRefProcessor(ref, RefFormat.URL, "bar");
new PropertyProcessor(cache, swagger).processProperty(mapProperty);
new FullVerifications() {
{
}
};
assertEquals(((RefProperty) mapProperty.getAdditionalProperties()).get$ref(), "#/definitions/bar");
}
Aggregations