From 8c73056fbfdfeee91387e9c3d22176eac18225a2 Mon Sep 17 00:00:00 2001 From: Jarkko Pesonen <435495+jrkkp@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:03:52 +0200 Subject: [PATCH] VKT(Backend): test for updating enrollment --- .../vkt/service/PublicEnrollmentServiceTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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);