WebSecurityInterceptor implements Interceptor { String redirectURL(Request request) { var builder = new StringBuilder("https: Map<String, String> params = request.queryParams(); if (!params.isEmpty()) { builder.append('?'); HTTPRequestHelper.urlEncoding(builder, params); } return builder.toString(); }  @Override Response intercept(Invocation invocation); public String contentSecurityPolicy; }
@Test void redirectURL() { when(request.hostName()).thenReturn("host"); when(request.path()).thenReturn("/path"); Map<String, String> queryParams = new LinkedHashMap<>(); queryParams.put("key1", "value1"); queryParams.put("key2", "value2"); queryParams.put("key3", ""); when(request.queryParams()).thenReturn(queryParams); String redirectURL = interceptor.redirectURL(request); assertThat(redirectURL).isEqualTo("https: }