Skip to content

Commit

Permalink
VKT(Backend): prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkkp committed Dec 19, 2024
1 parent 4982db9 commit 2be82ac
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
14 changes: 11 additions & 3 deletions backend/vkt/src/test/java/fi/oph/vkt/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public static ExaminerExamEvent examinerExamEvent(final Examiner examiner, final
return examinerExamEvent(examiner, municipality, ExamLanguage.FI);
}

public static ExaminerExamEvent examinerExamEvent(final Examiner examiner, final Municipality municipality, final ExamLanguage language) {
public static ExaminerExamEvent examinerExamEvent(
final Examiner examiner,
final Municipality municipality,
final ExamLanguage language
) {
final ExaminerExamEvent examEvent = new ExaminerExamEvent();
examEvent.setLanguage(language);
examEvent.setExaminer(examiner);
Expand Down Expand Up @@ -91,7 +95,11 @@ public static Enrollment enrollment(final ExamEvent examEvent, final Person pers
return enrollment;
}

public static EnrollmentAppointment enrollmentAppointment(final Examiner examiner, final ExaminerExamEvent examEvent, final Person person) {
public static EnrollmentAppointment enrollmentAppointment(
final Examiner examiner,
final ExaminerExamEvent examEvent,
final Person person
) {
final EnrollmentAppointment enrollment = new EnrollmentAppointment();
enrollment.setExaminer(examiner);
enrollment.setOralSkill(true);
Expand Down Expand Up @@ -160,7 +168,7 @@ public static Examiner examiner() {
examiner.setPhoneNumber("12345678");
examiner.setNickname("Vepe");

return examiner;
return examiner;
}

public static Municipality municipality() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.springframework.core.env.Environment;
import org.springframework.security.test.context.support.WithMockUser;


@WithMockUser
@DataJpaTest
public class ExaminerEnrollmentServiceTest {
Expand Down Expand Up @@ -81,15 +80,16 @@ public void setup() {
final UUIDSource uuidSource = mock(UUIDSource.class);
when(uuidSource.getRandomNonce()).thenReturn("269a2da4-58bb-45eb-b125-522b77e9167c");

examinerEnrollmentService = new ExaminerEnrollmentService(
enrollmentAppointmentRepository,
enrollmentGradesRepository,
examinerExamEventRepository,
environment,
uuidSource,
examinerEnrollmentEmailService,
auditService
);
examinerEnrollmentService =
new ExaminerEnrollmentService(
enrollmentAppointmentRepository,
enrollmentGradesRepository,
examinerExamEventRepository,
environment,
uuidSource,
examinerEnrollmentEmailService,
auditService
);
}

@Test
Expand All @@ -107,7 +107,11 @@ public void testUpdate() {
entityManager.persist(enrollment);

final ExaminerEnrollmentAppointmentUpdateDTO dto = createUpdateDTOAddingOne(enrollment);
final ExaminerEnrollmentAppointmentDTO responseDTO = examinerEnrollmentService.updateAppointment(examiner.getOid(), enrollment.getId(), dto);
final ExaminerEnrollmentAppointmentDTO responseDTO = examinerEnrollmentService.updateAppointment(
examiner.getOid(),
enrollment.getId(),
dto
);

assertEquals(responseDTO.id(), dto.id());
assertEquals(responseDTO.version(), dto.version() + 1);
Expand All @@ -129,26 +133,26 @@ public void testUpdate() {

private ExaminerEnrollmentAppointmentUpdateDTO createUpdateDTOAddingOne(final EnrollmentAppointment enrollment) {
return ExaminerEnrollmentAppointmentUpdateDTO
.builder()
.id(enrollment.getId())
.firstName("Irma")
.lastName("Ilmoittautuja")
.version(enrollment.getVersion())
.oralSkill(!enrollment.isOralSkill())
.textualSkill(!enrollment.isTextualSkill())
.understandingSkill(!enrollment.isUnderstandingSkill())
.speakingPartialExam(!enrollment.isSpeakingPartialExam())
.speechComprehensionPartialExam(!enrollment.isSpeechComprehensionPartialExam())
.writingPartialExam(!enrollment.isWritingPartialExam())
.readingComprehensionPartialExam(!enrollment.isReadingComprehensionPartialExam())
.previousEnrollment(enrollment.getPreviousEnrollment() != null ? enrollment.getPreviousEnrollment() + "X" : null)
.email(enrollment.getEmail() + "x")
.phoneNumber(enrollment.getPhoneNumber() + "X")
.street(enrollment.getStreet() + "X")
.postalCode(enrollment.getPostalCode() + "X")
.town(enrollment.getTown() + "X")
.country(enrollment.getCountry() + "X")
.hasPreviousEnrollment(true)
.build();
.builder()
.id(enrollment.getId())
.firstName("Irma")
.lastName("Ilmoittautuja")
.version(enrollment.getVersion())
.oralSkill(!enrollment.isOralSkill())
.textualSkill(!enrollment.isTextualSkill())
.understandingSkill(!enrollment.isUnderstandingSkill())
.speakingPartialExam(!enrollment.isSpeakingPartialExam())
.speechComprehensionPartialExam(!enrollment.isSpeechComprehensionPartialExam())
.writingPartialExam(!enrollment.isWritingPartialExam())
.readingComprehensionPartialExam(!enrollment.isReadingComprehensionPartialExam())
.previousEnrollment(enrollment.getPreviousEnrollment() != null ? enrollment.getPreviousEnrollment() + "X" : null)
.email(enrollment.getEmail() + "x")
.phoneNumber(enrollment.getPhoneNumber() + "X")
.street(enrollment.getStreet() + "X")
.postalCode(enrollment.getPostalCode() + "X")
.town(enrollment.getTown() + "X")
.country(enrollment.getCountry() + "X")
.hasPreviousEnrollment(true)
.build();
}
}

0 comments on commit 2be82ac

Please sign in to comment.