GetSnapshotHistoryTaskParameters extends BaseDTO { public static GetSnapshotHistoryTaskParameters deserialize(String taskParameters) { JaxbJsonSerializer<GetSnapshotHistoryTaskParameters> serializer = new JaxbJsonSerializer<>(GetSnapshotHistoryTaskParameters.class); try { GetSnapshotHistoryTaskParameters 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 serialize(); static GetSnapshotHistoryTaskParameters deserialize(String taskParameters);  }
@Test public void testDeserialize() { String taskParamsSerialized = "{\"snapshotId\" : \"" + snapshotId + "\"," + "\"pageNumber\" : " + pageNumber + "," + " \"pageSize\" : " + pageSize + "}"; GetSnapshotHistoryTaskParameters taskParams = GetSnapshotHistoryTaskParameters.deserialize(taskParamsSerialized); assertEquals(snapshotId, taskParams.getSnapshotId()); assertEquals(pageNumber, taskParams.getPageNumber()); assertEquals(pageSize, taskParams.getPageSize()); taskParamsSerialized = "{\"snapshotId\" : \"\"}"; try { GetSnapshotHistoryTaskParameters.deserialize(taskParamsSerialized); fail("Exception expected: Invalid params"); } catch (SnapshotDataException e) { } try { GetSnapshotHistoryTaskParameters.deserialize(""); fail("Exception expected: Invalid params"); } catch (SnapshotDataException e) { } }