### Question:
PortabilityJob { public static PortabilityJob.Builder builder() { Instant now = Instant.now(); return new org.datatransferproject.spi.cloud.types.AutoValue_PortabilityJob.Builder() .setState(State.NEW) .setCreatedTimestamp(now) .setLastUpdateTimestamp(now) .setFailureReason(null); }  static PortabilityJob.Builder builder(); static PortabilityJob fromMap(Map<String, Object> properties); @JsonProperty("state") abstract State state(); @JsonProperty("exportService") abstract String exportService(); @JsonProperty("importService") abstract String importService(); @JsonProperty("transferDataType") abstract String transferDataType(); @Nullable @JsonProperty("exportInformation") abstract String exportInformation(); @JsonProperty("createdTimestamp") abstract Instant createdTimestamp(); @JsonProperty("lastUpdateTimestamp") abstract Instant lastUpdateTimestamp(); @JsonProperty("jobAuthorization") abstract JobAuthorization jobAuthorization(); @Nullable @JsonProperty("failureReason") abstract String failureReason(); abstract PortabilityJob.Builder toBuilder(); Map<String, Object> toMap(); static final String AUTHORIZATION_STATE; }### Answer:
@Test public void verifySerializeDeserialize() throws Exception { ObjectMapper objectMapper = ObjectMapperFactory.createObjectMapper(); Instant date = Instant.now(); JobAuthorization jobAuthorization = JobAuthorization.builder() .setState(JobAuthorization.State.INITIAL) .setSessionSecretKey("foo") .build(); PortabilityJob job = PortabilityJob.builder() .setState(State.NEW) .setExportService("fooService") .setImportService("barService") .setTransferDataType("PHOTOS") .setCreatedTimestamp(date) .setLastUpdateTimestamp(date.plusSeconds(120)) .setJobAuthorization(jobAuthorization) .build(); String serializedJobAuthorization = objectMapper.writeValueAsString(jobAuthorization); JobAuthorization deserializedJobAuthorization = objectMapper.readValue(serializedJobAuthorization, JobAuthorization.class); assertThat(deserializedJobAuthorization).isEqualTo(jobAuthorization); String serializedJob = objectMapper.writeValueAsString(job); PortabilityJob deserializedJob = objectMapper.readValue(serializedJob, PortabilityJob.class); assertThat(deserializedJob).isEqualTo(job); }
@Test public void verifySerializeDeserializeWithAlbum() throws IOException { ObjectMapper objectMapper = ObjectMapperFactory.createObjectMapper(); Instant date = Instant.now(); JobAuthorization jobAuthorization = JobAuthorization.builder() .setState(JobAuthorization.State.INITIAL) .setSessionSecretKey("foo") .build(); PortabilityJob job = PortabilityJob.builder() .setState(State.NEW) .setExportService("fooService") .setImportService("barService") .setTransferDataType("PHOTOS") .setExportInformation(objectMapper.writeValueAsString( new ExportInformation( null, new PhotosContainerResource( Lists.newArrayList( new PhotoAlbum("album_id", "album name", "album description")), null)))) .setCreatedTimestamp(date) .setLastUpdateTimestamp(date.plusSeconds(120)) .setJobAuthorization(jobAuthorization) .build(); String serializedJobAuthorization = objectMapper.writeValueAsString(jobAuthorization); JobAuthorization deserializedJobAuthorization = objectMapper.readValue(serializedJobAuthorization, JobAuthorization.class); assertThat(deserializedJobAuthorization).isEqualTo(jobAuthorization); String serializedJob = objectMapper.writeValueAsString(job); PortabilityJob deserializedJob = objectMapper.readValue(serializedJob, PortabilityJob.class); assertThat(deserializedJob).isEqualTo(job); }