use of org.apache.servicecomb.inspector.internal.swagger.SchemaFormat in project java-chassis by ServiceComb.
the class TestInspectorImpl method downloadSchemas_failed.
@Test
public void downloadSchemas_failed() {
SchemaFormat format = SchemaFormat.SWAGGER;
new Expectations(format) {
{
format.getSuffix();
result = new RuntimeExceptionWithoutStackTrace("zip failed.");
}
};
try (LogCollector logCollector = new LogCollector()) {
Response response = inspector.downloadSchemas(format);
Assert.assertEquals("failed to create schemas zip file, format=SWAGGER.", logCollector.getLastEvents().getMessage());
InvocationException invocationException = response.getResult();
Assert.assertEquals(Status.INTERNAL_SERVER_ERROR, invocationException.getStatus());
Assert.assertEquals("failed to create schemas zip file, format=SWAGGER.", ((CommonExceptionData) invocationException.getErrorData()).getMessage());
Assert.assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
Assert.assertEquals(Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), response.getReasonPhrase());
}
}
Aggregations