@Test public void shouldProcessPreEncodedParamsIgnoringEncodingFlag() throws Exception { Serializer serializer = new ToStringSerializer(); ParamConfig paramConfig = mock(ParamConfig.class); when(paramConfig.getSerializer()).thenReturn(serializer); when(paramConfig.isEncoded()).thenReturn(true); when(paramConfig.getName()).thenReturn("p1"); Param param = mock(Param.class); when(param.getParamConfig()).thenReturn(paramConfig); when(param.getValue()).thenReturn((Collection) asList("v%2011", "v%2012")); List<EncodedPair> actual = toTest.process(param, UTF8, false); assertEquals(1, actual.size()); assertEquals("Cookie", actual.get(0).getName()); assertEquals("p1=v%2011,p1=v%2012", actual.get(0).getValue()); }
@Override public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = super.process(param, charset, encodeIfNeeded); String cookie = join(pairs, ','); if(isBlank(cookie)) { return Collections.emptyList(); } return singletonList(toPreEncodedPair("Cookie", cookie)); }
DefaultCookieParamProcessor extends DefaultParamProcessor { @Override public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = super.process(param, charset, encodeIfNeeded); String cookie = join(pairs, ','); if(isBlank(cookie)) { return Collections.emptyList(); } return singletonList(toPreEncodedPair("Cookie", cookie)); } }
DefaultCookieParamProcessor extends DefaultParamProcessor { @Override public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = super.process(param, charset, encodeIfNeeded); String cookie = join(pairs, ','); if(isBlank(cookie)) { return Collections.emptyList(); } return singletonList(toPreEncodedPair("Cookie", cookie)); }  }
DefaultCookieParamProcessor extends DefaultParamProcessor { @Override public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = super.process(param, charset, encodeIfNeeded); String cookie = join(pairs, ','); if(isBlank(cookie)) { return Collections.emptyList(); } return singletonList(toPreEncodedPair("Cookie", cookie)); }  @Override List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded); }
DefaultCookieParamProcessor extends DefaultParamProcessor { @Override public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = super.process(param, charset, encodeIfNeeded); String cookie = join(pairs, ','); if(isBlank(cookie)) { return Collections.emptyList(); } return singletonList(toPreEncodedPair("Cookie", cookie)); }  @Override List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded);  }