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