EnableStreamingTaskResult { public String serialize() { JaxbJsonSerializer<EnableStreamingTaskResult> serializer = new JaxbJsonSerializer<>(EnableStreamingTaskResult.class); try { return serializer.serialize(this); } catch (IOException e) { throw new TaskDataException( "Unable to create task result due to: " + e.getMessage()); } } EnableStreamingTaskResult();  EnableStreamingTaskResult(String result, String streamingHost); String getResult(); void setResult(String result); String getStreamingHost(); void setStreamingHost(String streamingHost); String serialize(); static EnableStreamingTaskResult deserialize(String taskResult);  }
@Test public void testSerialize() { EnableStreamingTaskResult taskResult = new EnableStreamingTaskResult(); taskResult.setResult(resultValue); taskResult.setStreamingHost(streamingHost); String result = taskResult.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"result\":\"" + resultValue + "\"")); assertThat(cleanResult, containsString("\"streamingHost\":\"" + streamingHost + "\"")); }