SetStoragePolicyTaskParameters { public String serialize() { JaxbJsonSerializer<SetStoragePolicyTaskParameters> serializer = new JaxbJsonSerializer<>(SetStoragePolicyTaskParameters.class); try { return serializer.serialize(this); } catch (IOException e) { throw new TaskDataException( "Unable to create task parameters due to: " + e.getMessage()); } } SetStoragePolicyTaskParameters(); String getSpaceId(); void setSpaceId(String spaceId); String getStorageClass(); void setStorageClass(String storageClass); Integer getDaysToTransition(); void setDaysToTransition(Integer daysToTransition); String serialize(); static SetStoragePolicyTaskParameters deserialize(String taskParameters);  }
@Test public void testSerialize() { SetStoragePolicyTaskParameters taskParams = new SetStoragePolicyTaskParameters(); taskParams.setSpaceId(spaceId); taskParams.setStorageClass(storageClass); taskParams.setDaysToTransition(daysToTransition); String result = taskParams.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"spaceId\":\"" + spaceId + "\"")); assertThat(cleanResult, containsString("\"storageClass\":\"" + storageClass + "\"")); assertThat(cleanResult, containsString("\"daysToTransition\":" + daysToTransition)); }