GetSnapshotContentsTaskParameters extends BaseDTO { public static GetSnapshotContentsTaskParameters deserialize(String taskParameters) { JaxbJsonSerializer<GetSnapshotContentsTaskParameters> serializer = new JaxbJsonSerializer<>(GetSnapshotContentsTaskParameters.class); try { GetSnapshotContentsTaskParameters params = serializer.deserialize(taskParameters); if (null == params.getSnapshotId() || params.getSnapshotId().isEmpty()) { throw new SnapshotDataException( "Value for snapshot ID may not be empty"); } return params; } catch (IOException e) { throw new SnapshotDataException( "Unable to parse task parameters due to: " + e.getMessage()); } }  String getSnapshotId(); void setSnapshotId(String snapshotId); int getPageNumber(); void setPageNumber(int pageNumber); int getPageSize(); void setPageSize(int pageSize); String getPrefix(); void setPrefix(String prefix); String serialize(); static GetSnapshotContentsTaskParameters deserialize(String taskParameters);  }
@Test public void testDeserialize() { String taskParamsSerialized = "{\"snapshotId\" : \"" + snapshotId + "\"," + "\"pageNumber\" : " + pageNumber + "," + " \"pageSize\" : " + pageSize + "," + " \"prefix\" : \"" + prefix + "\"}"; GetSnapshotContentsTaskParameters taskParams = GetSnapshotContentsTaskParameters.deserialize(taskParamsSerialized); assertEquals(snapshotId, taskParams.getSnapshotId()); assertEquals(pageNumber, taskParams.getPageNumber()); assertEquals(pageSize, taskParams.getPageSize()); assertEquals(prefix, taskParams.getPrefix()); taskParamsSerialized = "{\"snapshotId\" : \"\"}"; try { GetSnapshotContentsTaskParameters.deserialize(taskParamsSerialized); fail("Exception expected: Invalid params"); } catch (SnapshotDataException e) { } try { GetSnapshotContentsTaskParameters.deserialize(""); fail("Exception expected: Invalid params"); } catch (SnapshotDataException e) { } }