use of org.apache.servicecomb.common.rest.RestProducerInvocation in project incubator-servicecomb-java-chassis by apache.
the class TestVertxRestDispatcher method failureHandlerErrorDataWithInvocation.
@Test
public void failureHandlerErrorDataWithInvocation(@Mocked RoutingContext context, @Mocked InvocationException e) {
RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
ErrorDataDecoderException edde = new ErrorDataDecoderException(e);
new Expectations() {
{
context.get(RestConst.REST_PRODUCER_INVOCATION);
result = restProducerInvocation;
context.failure();
returns(edde, edde);
}
};
Deencapsulation.invoke(dispatcher, "failureHandler", context);
Assert.assertSame(e, this.throwable);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocation in project incubator-servicecomb-java-chassis by apache.
the class TestVertxRestDispatcher method failureHandlerNormal.
@Test
public void failureHandlerNormal(@Mocked RoutingContext context) {
RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
Exception e = new Exception();
new Expectations() {
{
context.get(RestConst.REST_PRODUCER_INVOCATION);
result = restProducerInvocation;
context.failure();
returns(e, e);
}
};
Deencapsulation.invoke(dispatcher, "failureHandler", context);
Assert.assertSame(e, this.throwable);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocation in project java-chassis by ServiceComb.
the class MockHttpServerResponse method failureHandlerErrorDataWithInvocation.
@Test
public void failureHandlerErrorDataWithInvocation(@Mocked RoutingContext context, @Mocked InvocationException e) {
RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
ErrorDataDecoderException edde = new ErrorDataDecoderException(e);
MockHttpServerResponse response = new MockHttpServerResponse();
new Expectations() {
{
context.get(RestConst.REST_PRODUCER_INVOCATION);
result = restProducerInvocation;
context.failure();
returns(edde, edde);
context.response();
result = response;
}
};
Deencapsulation.invoke(dispatcher, "failureHandler", context);
Assert.assertSame(e, this.throwable);
Assert.assertTrue(response.responseClosed);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocation in project java-chassis by ServiceComb.
the class MockHttpServerResponse method failureHandlerNormal.
@Test
public void failureHandlerNormal(@Mocked RoutingContext context) {
RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
Exception e = new Exception();
MockHttpServerResponse response = new MockHttpServerResponse();
new Expectations() {
{
context.get(RestConst.REST_PRODUCER_INVOCATION);
result = restProducerInvocation;
context.failure();
returns(e, e);
context.response();
result = response;
}
};
Deencapsulation.invoke(dispatcher, "failureHandler", context);
Assert.assertSame(e, this.throwable);
Assert.assertTrue(response.responseClosed);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocation in project java-chassis by ServiceComb.
the class MockHttpServerResponse method failureHandlerErrorDataWithNormal.
@Test
public void failureHandlerErrorDataWithNormal(@Mocked RoutingContext context) {
RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
Exception e = new Exception();
ErrorDataDecoderException edde = new ErrorDataDecoderException(e);
MockHttpServerResponse response = new MockHttpServerResponse();
new Expectations() {
{
context.get(RestConst.REST_PRODUCER_INVOCATION);
result = restProducerInvocation;
context.failure();
returns(edde, edde);
context.response();
result = response;
}
};
Deencapsulation.invoke(dispatcher, "failureHandler", context);
Assert.assertSame(edde, this.throwable);
Assert.assertTrue(response.responseClosed);
}
Aggregations