package com.gentics.mesh.etc;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.Test;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.ext.web.ParsedHeaderValues;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.impl.RouteImpl;

public class RouterStorageTest {

	private RouterStorage storage = new RouterStorage(null, null, null, null);

	@Test
	public void testFailureHandler() throws Exception {
		RoutingContext rc = mock(RoutingContext.class);
		Route currentRoute = mock(RouteImpl.class);
		when(currentRoute.getPath()).thenReturn("/blub");
		when(rc.currentRoute()).thenReturn(currentRoute);
		ParsedHeaderValues headerValues = mock(ParsedHeaderValues.class);
		when(rc.parsedHeaders()).thenReturn(headerValues);
		HttpServerRequest request = mock(HttpServerRequest.class);
		when(request.query()).thenReturn("?blub");
		when(request.method()).thenReturn(HttpMethod.GET);
		when(rc.request()).thenReturn(request);
		when(rc.normalisedPath()).thenReturn("/blub");
		storage.getRootRouter().handleFailure(rc);
	}
}

@@ -123,24 +123,75 @@
 .junit.Test;
+%0A%0Aimport io.vertx.core.http.CaseInsensitiveHeaders;
 %0Aimport io.v
@@ -1069,16 +1069,54 @@
 d.GET);%0A
+%09%09when(request.uri()).thenReturn(%22%22);%0A
 %09%09when(r
@@ -1198,16 +1198,83 @@
 blub%22);%0A
+%09%09when(rc.queryParams()).thenReturn(new CaseInsensitiveHeaders());%0A
 %09%09storag

Fix regression in test due to vert.x update