use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class StatusItemTest method getFormattedElementOnResponseIsNull.
@Test
public void getFormattedElementOnResponseIsNull() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext context = Mockito.mock(RoutingContext.class);
param.setContextData(context);
Mockito.when(context.response()).thenReturn(null);
String result = STATUS_ELEMENT.getFormattedItem(param);
assertEquals("-", result);
}
use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class TraceIdItemTest method testGetFormattedElementOnDataIsNull.
@Test
public void testGetFormattedElementOnDataIsNull() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext routingContext = Mockito.mock(RoutingContext.class);
param.setContextData(routingContext);
Mockito.when(routingContext.data()).thenReturn(null);
String result = ELEMENT.getFormattedItem(param);
Assert.assertThat(result, is("-"));
}
use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class TraceIdItemTest method testGetFormattedElementOnInvocationContextIsNull.
@Test
public void testGetFormattedElementOnInvocationContextIsNull() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext routingContext = Mockito.mock(RoutingContext.class);
Map<String, Object> data = new HashMap<>();
Mockito.when(routingContext.data()).thenReturn(data);
param.setContextData(routingContext);
String result = ELEMENT.getFormattedItem(param);
Assert.assertThat(result, is("-"));
}
use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class UrlPathItemTest method getFormattedElementOnRequestIsNull.
@Test
public void getFormattedElementOnRequestIsNull() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext context = Mockito.mock(RoutingContext.class);
param.setContextData(context);
Mockito.when(context.request()).thenReturn(null);
String result = new UrlPathItem().getFormattedItem(param);
Assert.assertEquals("-", result);
}
use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class UrlPathItemTest method getFormattedElementOnMethodIsNull.
@Test
public void getFormattedElementOnMethodIsNull() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext context = Mockito.mock(RoutingContext.class);
HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
param.setContextData(context);
Mockito.when(context.request()).thenReturn(request);
Mockito.when(request.path()).thenReturn(null);
String result = new UrlPathItem().getFormattedItem(param);
Assert.assertEquals("-", result);
}
Aggregations