use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class UrlPathWithQueryItemTest method getFormattedElement.
@Test
public void getFormattedElement() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext context = Mockito.mock(RoutingContext.class);
HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
String uri = "uriTest";
param.setContextData(context);
Mockito.when(context.request()).thenReturn(request);
Mockito.when(request.uri()).thenReturn(uri);
String result = ELEMENT.getFormattedItem(param);
assertEquals(uri, result);
}
use of org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam in project incubator-servicecomb-java-chassis by apache.
the class UrlPathWithQueryItemTest method getFormattedElementOnUriIsNull.
@Test
public void getFormattedElementOnUriIsNull() {
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.uri()).thenReturn(null);
String result = 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 UrlPathWithQueryItemTest method getFormattedElementOnUriIsEmpty.
@Test
public void getFormattedElementOnUriIsEmpty() {
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
RoutingContext context = Mockito.mock(RoutingContext.class);
HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
String uri = "";
param.setContextData(context);
Mockito.when(context.request()).thenReturn(request);
Mockito.when(request.uri()).thenReturn(uri);
String result = 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 UrlPathWithQueryItemTest 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 = 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 HttpMethodItemTest method getFormattedElementOnMethodIsNull.
@Test
public void getFormattedElementOnMethodIsNull() {
RoutingContext routingContext = Mockito.mock(RoutingContext.class);
HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
AccessLogParam<RoutingContext> param = new AccessLogParam<>();
param.setContextData(routingContext);
Mockito.when(routingContext.request()).thenReturn(request);
Mockito.when(request.method()).thenReturn(null);
Assert.assertEquals("-", new HttpMethodItem().getFormattedItem(param));
}
Aggregations