SignedCookieData { public String serialize() { JaxbJsonSerializer<SignedCookieData> serializer = new JaxbJsonSerializer<>(SignedCookieData.class); try { return serializer.serialize(this); } catch (IOException e) { throw new TaskDataException( "Unable to create task parameters due to: " + e.getMessage()); } } SignedCookieData(); Map<String, String> getSignedCookies(); void setSignedCookies(Map<String, String> signedCookies); String getStreamingHost(); void setStreamingHost(String streamingHost); String getRedirectUrl(); void setRedirectUrl(String redirectUrl); String serialize(); static SignedCookieData deserialize(String taskParameters);  }
@Test public void testSerialize() { SignedCookieData taskParams = new SignedCookieData(); taskParams.setSignedCookies(signedCookies); taskParams.setStreamingHost(streamingHost); taskParams.setRedirectUrl(redirectUrl); String result = taskParams.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"signedCookies\":{\"" + cloudfrontPolicyKey + "\":\"" + cloudfrontPolicyVal + "\",\"" + cloudfrontSignatureKey + "\":\"" + cloudfrontSignatureVal + "\",\"" + cloudfrontKeyPairIdKey + "\":\"" + cloudfrontKeyPairIdVal + "\"}")); assertThat(cleanResult, containsString("\"streamingHost\":\"" + streamingHost + "\"")); assertThat(cleanResult, containsString("\"redirectUrl\":\"" + redirectUrl + "\"")); }