ContextValueEncoderImpl implements ContextValueEncoder { public <T> T toValue(Class<T> requiredType, String clientValue) { assert requiredType != null; ValueEncoder<T> encoder = valueEncoderSource.getValueEncoder(requiredType); return encoder.toValue(clientValue); } ContextValueEncoderImpl(ValueEncoderSource valueEncoderSource); String toClient(Object value); T toValue(Class<T> requiredType, String clientValue);  }
@Test public void to_value() { ValueEncoder valueEncoder = mockValueEncoder(); ValueEncoderSource source = mockValueEncoderSource(); Long value = 23L; String clientValue = "twentythree"; train_getValueEncoder(source, Long.class, valueEncoder); train_toValue(valueEncoder, clientValue, value); replay(); ContextValueEncoder cve = new ContextValueEncoderImpl(source); assertSame(cve.toValue(Long.class, clientValue), value); verify(); }