diff --git a/backend/vkt/src/test/java/fi/oph/vkt/service/PublicEnrollmentServiceTest.java b/backend/vkt/src/test/java/fi/oph/vkt/service/PublicEnrollmentServiceTest.java index f8a577ab9..33ce8dd15 100644 --- a/backend/vkt/src/test/java/fi/oph/vkt/service/PublicEnrollmentServiceTest.java +++ b/backend/vkt/src/test/java/fi/oph/vkt/service/PublicEnrollmentServiceTest.java @@ -137,6 +137,22 @@ public void testInitialiseEnrollmentShouldUpdateExpiresAtForExistingReservation( assertTrue(reservationRepository.findById(dto.reservation().id()).isPresent()); } + @Test + public void testUpdateCanceledEnrollment() { + final ExamEvent examEvent = createExamEvent(2); + final Enrollment enrollment = createEnrollment(examEvent, EnrollmentStatus.EXPECTING_PAYMENT_UNFINISHED_ENROLLMENT); + final Person person = enrollment.getPerson(); + + publicEnrollmentService.initialiseEnrollment(examEvent.getId(), person); + assertEquals(EnrollmentStatus.CANCELED_UNFINISHED_ENROLLMENT, enrollment.getStatus()); + + final PublicEnrollmentCreateDTO dto = createDTOBuilder().oralSkill(false).digitalCertificateConsent(false).build(); + publicEnrollmentService.updateEnrollmentForPayment(dto, examEvent.getId(), person); + + assertEquals(EnrollmentStatus.EXPECTING_PAYMENT_UNFINISHED_ENROLLMENT, enrollment.getStatus()); + assertFalse(enrollment.isOralSkill()); + } + @Test public void testInitialiseEnrollmentWithUnfinishedPayment() { final ExamEvent examEvent = createExamEvent(2);