@Test public void cancelConvocation() { Convocation convocation = convocationService.getConvocation("anything", "anything"); convocationService.cancelConvocation(convocation); assertTrue(convocation.isCancelled()); verify(convocationRepository).save(argThat(Convocation::isCancelled)); }
public void cancelConvocation(Convocation convocation) { if (convocation.isCancelled()) { LOGGER.error("Try to cancel an already cancelled convocation : {}", convocation.getUuid()); throw new ConvocationCancelledException(); } convocation.setCancelled(true); convocation.setCancellationDate(LocalDateTime.now()); convocationRepository.save(convocation); addHistory(convocation, HistoryType.CANCELLED); applicationEventPublisher.publishEvent(new ConvocationCancelledEvent(this, convocation)); }
ConvocationService { public void cancelConvocation(Convocation convocation) { if (convocation.isCancelled()) { LOGGER.error("Try to cancel an already cancelled convocation : {}", convocation.getUuid()); throw new ConvocationCancelledException(); } convocation.setCancelled(true); convocation.setCancellationDate(LocalDateTime.now()); convocationRepository.save(convocation); addHistory(convocation, HistoryType.CANCELLED); applicationEventPublisher.publishEvent(new ConvocationCancelledEvent(this, convocation)); } }
ConvocationService { public void cancelConvocation(Convocation convocation) { if (convocation.isCancelled()) { LOGGER.error("Try to cancel an already cancelled convocation : {}", convocation.getUuid()); throw new ConvocationCancelledException(); } convocation.setCancelled(true); convocation.setCancellationDate(LocalDateTime.now()); convocationRepository.save(convocation); addHistory(convocation, HistoryType.CANCELLED); applicationEventPublisher.publishEvent(new ConvocationCancelledEvent(this, convocation)); } @Autowired  ConvocationService(
            ConvocationRepository convocationRepository,
            LocalAuthorityService localAuthorityService,
            StorageService storageService,
            ExternalRestService externalRestService,
            LocalesService localesService,
            TagService tagService,
            RecipientResponseRepository recipientResponseRepository,
            QuestionResponseRepository questionResponseRepository,
            AttachmentRepository attachmentRepository,
            ApplicationEventPublisher applicationEventPublisher,
            PdfGeneratorUtil pdfGeneratorUtil); }
ConvocationService { public void cancelConvocation(Convocation convocation) { if (convocation.isCancelled()) { LOGGER.error("Try to cancel an already cancelled convocation : {}", convocation.getUuid()); throw new ConvocationCancelledException(); } convocation.setCancelled(true); convocation.setCancellationDate(LocalDateTime.now()); convocationRepository.save(convocation); addHistory(convocation, HistoryType.CANCELLED); applicationEventPublisher.publishEvent(new ConvocationCancelledEvent(this, convocation)); } @Autowired  ConvocationService(
            ConvocationRepository convocationRepository,
            LocalAuthorityService localAuthorityService,
            StorageService storageService,
            ExternalRestService externalRestService,
            LocalesService localesService,
            TagService tagService,
            RecipientResponseRepository recipientResponseRepository,
            QuestionResponseRepository questionResponseRepository,
            AttachmentRepository attachmentRepository,
            ApplicationEventPublisher applicationEventPublisher,
            PdfGeneratorUtil pdfGeneratorUtil); Convocation getConvocation(String uuid); Convocation openBy(Convocation convocation, Recipient recipient); Convocation create(Convocation convocation, String localAuthorityUuid, String profileUuid); Convocation update(String uuid, String localAuthorityUuid, Convocation params); Convocation getConvocation(String uuid, String localAuthorityUuid); void delete(Convocation convocation); void cancelConvocation(Convocation convocation); Convocation getByUuid(String uuid, String localAuthorityUuid); void uploadFiles(Convocation convocation, MultipartFile file,
            MultipartFile procuration, MultipartFile[] annexes, String[] tagsIds); void uploadAdditionalFiles(Convocation convocation, MultipartFile[] annexes, String[] tagsIds); void uploadMinutes(Convocation convocation, MultipartFile minutes); Attachment getFile(Convocation convocation, String fileUuid); byte[] getStampedFile(byte[] content, LocalDateTime sentDate, LocalAuthority localAuthority, Integer x,
            Integer y); void answerConvocation(Convocation convocation, Recipient recipient, ResponseType responseType,
            String substituteUuid); void answerQuestion(Convocation convocation, Recipient currentRecipient, String questionUuid,
            Boolean response); void convocationSent(Convocation convocation); Profile retrieveProfile(String profileUuid); List<Convocation> getConvocationsToRemind(int reminderDelay); List<String> getNoResponseInformation(); void addTagToFile(Convocation convocation, String fileUuid, String tagUuid); void removeTagFromFile(Convocation convocation, String fileUuid, String tagUuid); ByteArrayOutputStream createArchive(Convocation convocation); Long countSentWithQuery(String multifield, LocalDate sentDateFrom, LocalDate sentDateTo, String
            assemblyType, LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject,
            String filter, String currentLocalAuthUuid, Set<String> groups); Long countReceivedWithQuery(String multifield, String assemblyType, LocalDate meetingDateFrom,
            LocalDate meetingDateTo, String subject, String filter, String currentLocalAuthUuid, Recipient recipient); List<Convocation> findSentWithQuery(String multifield, LocalDate sentDateFrom, LocalDate sentDateTo,
            String assemblyType, LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject, String filter,
            Integer limit, Integer offset, String column, String direction,
            String currentLocalAuthUuid, Set<String> groups); List<Convocation> findReceivedWithQuery(String multifield, String assemblyType,
            LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject, String filter, Integer limit,
            Integer offset, String column, String direction,
            String currentLocalAuthUuid, Recipient recipient); }
ConvocationService { public void cancelConvocation(Convocation convocation) { if (convocation.isCancelled()) { LOGGER.error("Try to cancel an already cancelled convocation : {}", convocation.getUuid()); throw new ConvocationCancelledException(); } convocation.setCancelled(true); convocation.setCancellationDate(LocalDateTime.now()); convocationRepository.save(convocation); addHistory(convocation, HistoryType.CANCELLED); applicationEventPublisher.publishEvent(new ConvocationCancelledEvent(this, convocation)); } @Autowired  ConvocationService(
            ConvocationRepository convocationRepository,
            LocalAuthorityService localAuthorityService,
            StorageService storageService,
            ExternalRestService externalRestService,
            LocalesService localesService,
            TagService tagService,
            RecipientResponseRepository recipientResponseRepository,
            QuestionResponseRepository questionResponseRepository,
            AttachmentRepository attachmentRepository,
            ApplicationEventPublisher applicationEventPublisher,
            PdfGeneratorUtil pdfGeneratorUtil); Convocation getConvocation(String uuid); Convocation openBy(Convocation convocation, Recipient recipient); Convocation create(Convocation convocation, String localAuthorityUuid, String profileUuid); Convocation update(String uuid, String localAuthorityUuid, Convocation params); Convocation getConvocation(String uuid, String localAuthorityUuid); void delete(Convocation convocation); void cancelConvocation(Convocation convocation); Convocation getByUuid(String uuid, String localAuthorityUuid); void uploadFiles(Convocation convocation, MultipartFile file,
            MultipartFile procuration, MultipartFile[] annexes, String[] tagsIds); void uploadAdditionalFiles(Convocation convocation, MultipartFile[] annexes, String[] tagsIds); void uploadMinutes(Convocation convocation, MultipartFile minutes); Attachment getFile(Convocation convocation, String fileUuid); byte[] getStampedFile(byte[] content, LocalDateTime sentDate, LocalAuthority localAuthority, Integer x,
            Integer y); void answerConvocation(Convocation convocation, Recipient recipient, ResponseType responseType,
            String substituteUuid); void answerQuestion(Convocation convocation, Recipient currentRecipient, String questionUuid,
            Boolean response); void convocationSent(Convocation convocation); Profile retrieveProfile(String profileUuid); List<Convocation> getConvocationsToRemind(int reminderDelay); List<String> getNoResponseInformation(); void addTagToFile(Convocation convocation, String fileUuid, String tagUuid); void removeTagFromFile(Convocation convocation, String fileUuid, String tagUuid); ByteArrayOutputStream createArchive(Convocation convocation); Long countSentWithQuery(String multifield, LocalDate sentDateFrom, LocalDate sentDateTo, String
            assemblyType, LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject,
            String filter, String currentLocalAuthUuid, Set<String> groups); Long countReceivedWithQuery(String multifield, String assemblyType, LocalDate meetingDateFrom,
            LocalDate meetingDateTo, String subject, String filter, String currentLocalAuthUuid, Recipient recipient); List<Convocation> findSentWithQuery(String multifield, LocalDate sentDateFrom, LocalDate sentDateTo,
            String assemblyType, LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject, String filter,
            Integer limit, Integer offset, String column, String direction,
            String currentLocalAuthUuid, Set<String> groups); List<Convocation> findReceivedWithQuery(String multifield, String assemblyType,
            LocalDate meetingDateFrom, LocalDate meetingDateTo, String subject, String filter, Integer limit,
            Integer offset, String column, String direction,
            String currentLocalAuthUuid, Recipient recipient);  }