RdpConfig implements IRemoteConfig { @Override public String toJSON() { final ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); String json = null; try { mapper.writeValue(stream, this); json = new String(stream.toByteArray(), "UTF-8"); } catch (final IOException e) { Err.process(e); } return json; } RdpConfig(final String fullAddress);  RdpConfig(final String fullAddress, final String username); @Override IResource getResource(); @Override String toString(); @Override String toJSON();  }
@Test public void assertThatRdpConfigIsSerializedAsJSON() { final String json = rdpConfig.toJSON(); Assertions.assertThat(json).isNotNull(); }