@Test public void shouldProcessParamIgnoringEncodingFlag() throws Exception { Serializer serializer = new ToStringSerializer(); ParamConfig paramConfig = mock(ParamConfig.class); when(paramConfig.getSerializer()).thenReturn(serializer); when(paramConfig.isEncoded()).thenReturn(false); when(paramConfig.getName()).thenReturn("p1"); Param param = mock(Param.class); when(param.getParamConfig()).thenReturn(paramConfig); when(param.getValue()).thenReturn((Collection) asList("v 11", "v 12")); List<EncodedPair> actual = toTest.process(param, UTF8, false); assertEquals(2, actual.size()); assertEquals("p1", actual.get(0).getName()); assertEquals("v 11", actual.get(0).getValue()); assertEquals("p1", actual.get(1).getName()); assertEquals("v 12", actual.get(1).getValue()); }
public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); Serializer serializer = param.getParamConfig().getSerializer(); boolean isEncoded = !encodeIfNeeded || param.getParamConfig().isEncoded(); for(Object value : param.getValue()){ String serializedValue = Serializers.serialize(serializer, value, charset); pairs.add(toPair(param.getParamConfig().getName(), serializedValue, charset, isEncoded)); } return pairs; }
DefaultParamProcessor implements ParamProcessor { public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); Serializer serializer = param.getParamConfig().getSerializer(); boolean isEncoded = !encodeIfNeeded || param.getParamConfig().isEncoded(); for(Object value : param.getValue()){ String serializedValue = Serializers.serialize(serializer, value, charset); pairs.add(toPair(param.getParamConfig().getName(), serializedValue, charset, isEncoded)); } return pairs; } }
DefaultParamProcessor implements ParamProcessor { public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); Serializer serializer = param.getParamConfig().getSerializer(); boolean isEncoded = !encodeIfNeeded || param.getParamConfig().isEncoded(); for(Object value : param.getValue()){ String serializedValue = Serializers.serialize(serializer, value, charset); pairs.add(toPair(param.getParamConfig().getName(), serializedValue, charset, isEncoded)); } return pairs; }  }
DefaultParamProcessor implements ParamProcessor { public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); Serializer serializer = param.getParamConfig().getSerializer(); boolean isEncoded = !encodeIfNeeded || param.getParamConfig().isEncoded(); for(Object value : param.getValue()){ String serializedValue = Serializers.serialize(serializer, value, charset); pairs.add(toPair(param.getParamConfig().getName(), serializedValue, charset, isEncoded)); } return pairs; }  List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded); }
DefaultParamProcessor implements ParamProcessor { public List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded) throws Exception { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); Serializer serializer = param.getParamConfig().getSerializer(); boolean isEncoded = !encodeIfNeeded || param.getParamConfig().isEncoded(); for(Object value : param.getValue()){ String serializedValue = Serializers.serialize(serializer, value, charset); pairs.add(toPair(param.getParamConfig().getName(), serializedValue, charset, isEncoded)); } return pairs; }  List<EncodedPair> process(Param param, Charset charset, boolean encodeIfNeeded);  }