@Test public void test_serialize() { assertThat(codec.serialize(""), is(equalTo(""))); assertThat(codec.serialize("".getBytes(UTF_8)), is(equalTo(""))); assertThat(codec.serialize(" "), is(equalTo("IA=="))); assertThat(codec.serialize(" ".getBytes(UTF_8)), is(equalTo("IA=="))); assertThat(codec.serialize("foo"), is(equalTo("Zm9v"))); assertThat(codec.serialize("a string with space breaking diagnostic handler"), is(equalTo("YSBzdHJpbmcgd2l0aCBzcGFjZSBicmVha2luZyBkaWFnbm9zdGljIGhhbmRsZXI="))); }
@Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); return Base64.getEncoder().encodeToString(o instanceof byte[] ? (byte[]) o : o.toString().getBytes(UTF_8)); }
Base64DiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); return Base64.getEncoder().encodeToString(o instanceof byte[] ? (byte[]) o : o.toString().getBytes(UTF_8)); } }
Base64DiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); return Base64.getEncoder().encodeToString(o instanceof byte[] ? (byte[]) o : o.toString().getBytes(UTF_8)); } Base64DiagnosticCodec(); }
Base64DiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); return Base64.getEncoder().encodeToString(o instanceof byte[] ? (byte[]) o : o.toString().getBytes(UTF_8)); } Base64DiagnosticCodec(); @Override String serialize(Object o); @Override T deserialize(String response, Class<T> target); @Override String toString(); }
Base64DiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); return Base64.getEncoder().encodeToString(o instanceof byte[] ? (byte[]) o : o.toString().getBytes(UTF_8)); } Base64DiagnosticCodec(); @Override String serialize(Object o); @Override T deserialize(String response, Class<T> target); @Override String toString();  }