SignedCookieData { public static SignedCookieData deserialize(String taskParameters) { JaxbJsonSerializer<SignedCookieData> serializer = new JaxbJsonSerializer<>(SignedCookieData.class); try { return serializer.deserialize(taskParameters); } 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 testDeserialize() { String taskParamsSerialized = "{\"signedCookies\":{\"" + cloudfrontPolicyKey + "\":\"" + cloudfrontPolicyVal + "\",\"" + cloudfrontSignatureKey + "\":\"" + cloudfrontSignatureVal + "\",\"" + cloudfrontKeyPairIdKey + "\":\"" + cloudfrontKeyPairIdVal + "\"}," + " \"streamingHost\" : \"" + streamingHost + "\"," + " \"redirectUrl\" : \"" + redirectUrl + "\"}"; SignedCookieData taskParams = SignedCookieData.deserialize(taskParamsSerialized); Map<String, String> signedCookies = taskParams.getSignedCookies(); assertNotNull(signedCookies); assertEquals(cloudfrontPolicyVal, signedCookies.get(cloudfrontPolicyKey)); assertEquals(cloudfrontSignatureVal, signedCookies.get(cloudfrontSignatureKey)); assertEquals(cloudfrontKeyPairIdVal, signedCookies.get(cloudfrontKeyPairIdKey)); assertEquals(streamingHost, taskParams.getStreamingHost()); assertEquals(redirectUrl, taskParams.getRedirectUrl()); try { SignedCookieData.deserialize(""); fail("Exception expected: Invalid params"); } catch (TaskDataException e) { } }