### Question:
JaxbUtil { public static String marshalToString(Object object) { return IOCallback.execute( () -> { try (OutputStream out = new ByteArrayOutputStream()) { marshal(object, out); return out.toString(); } }); } private  JaxbUtil(); static T unmarshal(InputStream inputStream, Class<T> type); static void marshal(Object object, OutputStream outputStream); static void marshalWithNoValidation(Object object, OutputStream outputStream); static String marshalToString(Object object); static String marshalToStringNoValidation(Object object); static void marshalMasked(Config object, OutputStream outputStream); static final Class[] JAXB_CLASSES; }### Answer:
@Test public void marshalToString() { final KeyDataConfig input = new KeyDataConfig(new PrivateKeyData("VAL", null, null, null, null), PrivateKeyType.UNLOCKED); String resultData = JaxbUtil.marshalToString(input); JsonObject result = Json.createReader(new StringReader(resultData)).readObject(); assertThat(result).containsOnlyKeys("type", "data"); assertThat(result.getString("type")).isEqualTo("unlocked"); JsonObject jsonDataNode = result.getJsonObject("data"); assertThat(jsonDataNode).containsOnlyKeys("bytes"); assertThat(jsonDataNode.getString("bytes")).isEqualTo("VAL"); }