@Test void additionalInformationShouldBeSerializable() throws Exception { DeleteMailsFromMailQueueTask.AdditionalInformation detailsSender = new DeleteMailsFromMailQueueTask.AdditionalInformation(queueName, 10L, 5L, Optional.of(new MailAddress("a@b.c")), Optional.empty(), Optional.empty(), TIMESTAMP); DeleteMailsFromMailQueueTask.AdditionalInformation detailsName = new DeleteMailsFromMailQueueTask.AdditionalInformation(queueName, 1L, 0L, Optional.empty(), Optional.of("name"), Optional.empty(), TIMESTAMP); DeleteMailsFromMailQueueTask.AdditionalInformation detailsRecipient = new DeleteMailsFromMailQueueTask.AdditionalInformation(queueName, 6L, 6L, Optional.empty(), Optional.empty(), Optional.of(new MailAddress("d@e.f")), TIMESTAMP); JsonSerializationVerifier.dtoModule(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.module()) .testCase(detailsSender, "{\"type\": \"delete-mails-from-mail-queue\", \"mailQueueName\": \"anyQueue\", \"sender\": \"a@b.c\", \"initialCount\" : 10, \"remainingCount\":5, \"timestamp\": \"2018-11-13T12:00:55Z\"}") .testCase(detailsName, "{\"type\": \"delete-mails-from-mail-queue\", \"mailQueueName\": \"anyQueue\", \"name\": \"name\", \"initialCount\" : 1, \"remainingCount\":0, \"timestamp\": \"2018-11-13T12:00:55Z\"}") .testCase(detailsRecipient, "{\"type\": \"delete-mails-from-mail-queue\", \"mailQueueName\": \"anyQueue\", \"recipient\": \"d@e.f\", \"initialCount\" : 6, \"remainingCount\":6, \"timestamp\": \"2018-11-13T12:00:55Z\"}") .verify(); }
public static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module() { return DTOModule.forDomainObject(DeleteMailsFromMailQueueTask.AdditionalInformation.class) .convertToDTO(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.class) .toDomainObjectConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::fromDTO) .toDTOConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::toDTO) .typeName(DeleteMailsFromMailQueueTask.TYPE.asString()) .withFactory(AdditionalInformationDTOModule::new); }
WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO implements AdditionalInformationDTO { public static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module() { return DTOModule.forDomainObject(DeleteMailsFromMailQueueTask.AdditionalInformation.class) .convertToDTO(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.class) .toDomainObjectConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::fromDTO) .toDTOConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::toDTO) .typeName(DeleteMailsFromMailQueueTask.TYPE.asString()) .withFactory(AdditionalInformationDTOModule::new); } }
WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO implements AdditionalInformationDTO { public static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module() { return DTOModule.forDomainObject(DeleteMailsFromMailQueueTask.AdditionalInformation.class) .convertToDTO(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.class) .toDomainObjectConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::fromDTO) .toDTOConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::toDTO) .typeName(DeleteMailsFromMailQueueTask.TYPE.asString()) .withFactory(AdditionalInformationDTOModule::new); } WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO(@JsonProperty("type") String type,
                                                                        @JsonProperty("mailQueueName") String mailQueueName,
                                                                        @JsonProperty("sender") Optional<String> sender,
                                                                        @JsonProperty("name") Optional<String> name,
                                                                        @JsonProperty("recipient") Optional<String> recipient,
                                                                        @JsonProperty("initialCount") long initialCount,
                                                                        @JsonProperty("remainingCount") long remainingCount,
                                                                        @JsonProperty("timestamp") Instant timestamp); }
WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO implements AdditionalInformationDTO { public static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module() { return DTOModule.forDomainObject(DeleteMailsFromMailQueueTask.AdditionalInformation.class) .convertToDTO(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.class) .toDomainObjectConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::fromDTO) .toDTOConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::toDTO) .typeName(DeleteMailsFromMailQueueTask.TYPE.asString()) .withFactory(AdditionalInformationDTOModule::new); } WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO(@JsonProperty("type") String type,
                                                                        @JsonProperty("mailQueueName") String mailQueueName,
                                                                        @JsonProperty("sender") Optional<String> sender,
                                                                        @JsonProperty("name") Optional<String> name,
                                                                        @JsonProperty("recipient") Optional<String> recipient,
                                                                        @JsonProperty("initialCount") long initialCount,
                                                                        @JsonProperty("remainingCount") long remainingCount,
                                                                        @JsonProperty("timestamp") Instant timestamp); static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module(); String getMailQueueName(); Optional<String> getSender(); Optional<String> getName(); Optional<String> getRecipient(); long getInitialCount(); long getRemainingCount(); @Override Instant getTimestamp(); @Override String getType(); }
WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO implements AdditionalInformationDTO { public static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module() { return DTOModule.forDomainObject(DeleteMailsFromMailQueueTask.AdditionalInformation.class) .convertToDTO(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO.class) .toDomainObjectConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::fromDTO) .toDTOConverter(WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO::toDTO) .typeName(DeleteMailsFromMailQueueTask.TYPE.asString()) .withFactory(AdditionalInformationDTOModule::new); } WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO(@JsonProperty("type") String type,
                                                                        @JsonProperty("mailQueueName") String mailQueueName,
                                                                        @JsonProperty("sender") Optional<String> sender,
                                                                        @JsonProperty("name") Optional<String> name,
                                                                        @JsonProperty("recipient") Optional<String> recipient,
                                                                        @JsonProperty("initialCount") long initialCount,
                                                                        @JsonProperty("remainingCount") long remainingCount,
                                                                        @JsonProperty("timestamp") Instant timestamp); static AdditionalInformationDTOModule<DeleteMailsFromMailQueueTask.AdditionalInformation, WebAdminDeleteMailsFromMailQueueTaskAdditionalInformationDTO> module(); String getMailQueueName(); Optional<String> getSender(); Optional<String> getName(); Optional<String> getRecipient(); long getInitialCount(); long getRemainingCount(); @Override Instant getTimestamp(); @Override String getType();  }