Repository: urlaubsverwaltung/urlaubsverwaltung
Pull request #5181 (2025-02-21 08:08:06)

Rename "record" method of overtime to not match a restricted identifier.
<!--

Thanks for contributing to the Urlaubsverwaltung.
Please review the following notes before submitting you pull request.

Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize?

# Security Vulnerabilities

🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it.
Instead, please open a report of a security vulnerability via
[Report a security vulnerability](https://github.com/urlaubsverwaltung/urlaubsverwaltung/security/advisories/new)


# Describing Your Changes

If, having reviewed the notes above, you're ready to submit your pull request, please
provide a brief description of the proposed changes.

If they:
 🐞 fix a bug, please describe the broken behaviour and how the changes fix it.
    Please label with 'type: bug' and 'status: new'
    
 🎁 make an enhancement, please describe the new functionality and why you believe it's useful.
    Please label with 'type: enhancement' and 'status: new'
 
If your pull request relates to any existing issues,
please reference them by using the issue number prefixed with #.

-->



Patch:
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/dev/OvertimeRecordDataProvider.java b/src/main/java/org/synyx/urlaubsverwaltung/dev/OvertimeRecordDataProvider.java
index 9cf125a1c..325ef4f7b 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/dev/OvertimeRecordDataProvider.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/dev/OvertimeRecordDataProvider.java
@@ -31,6 +31,6 @@ class OvertimeRecordDataProvider {
 
     void createOvertimeRecord(Person person, LocalDate startDate, LocalDate endDate, Duration duration) {
         final Overtime overtime = new Overtime(person, startDate, endDate, duration);
-        overtimeService.record(overtime, Optional.of("Ich habe ganz viel gearbeitet"), person);
+        overtimeService.save(overtime, Optional.of("Ich habe ganz viel gearbeitet"), person);
     }
 }
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/extension/backup/backup/PersonDataCollectionService.java b/src/main/java/org/synyx/urlaubsverwaltung/extension/backup/backup/PersonDataCollectionService.java
index bbbd2c70c..ec8c59c09 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/extension/backup/backup/PersonDataCollectionService.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/extension/backup/backup/PersonDataCollectionService.java
@@ -55,7 +55,7 @@ class PersonDataCollectionService {
             final List<AccountDTO> accountDTOS = accountService.getHolidaysAccountsByPerson(person).stream().map(account -> new AccountDTO(account.getValidFrom(), account.getValidTo(), account.isDoRemainingVacationDaysExpireLocally(), account.isDoRemainingVacationDaysExpireGlobally(), account.getExpiryDateLocally(), account.getExpiryDateGlobally(), account.getExpiryNotificationSentDate(), account.getAnnualVacationDays(), account.getActualVacationDays(), account.getRemainingVacationDays(), account.getRemainingVacationDaysNotExpiring(), account.getComment())).toList();
             final List<WorkingTimeDTO> workingTimeDTOS = workingTimeService.getByPerson(person).stream().map(workingTime -> new WorkingTimeDTO(DayLengthDTO.valueOf(workingTime.getMonday().name()), DayLengthDTO.valueOf(workingTime.getTuesday().name()), DayLengthDTO.valueOf(workingTime.getWednesday().name()), DayLengthDTO.valueOf(workingTime.getThursday().name()), DayLengthDTO.valueOf(workingTime.getFriday().name()), DayLengthDTO.valueOf(workingTime.getSaturday().name()), DayLengthDTO.valueOf(workingTime.getSunday().name()), workingTime.getValidFrom(), FederalStateDTO.valueOf(workingTime.getFederalState().name()), workingTime.isDefaultFederalState())).toList();
 
-            final UserNotificationSettingsDTO userNotificationSettingsDTO = new UserNotificationSettingsDTO(userNotificationSettingsService.findNotificationSettings(new PersonId(person.getId())).isRestrictToDepartments());
+            final UserNotificationSettingsDTO userNotificationSettingsDTO = new UserNotificationSettingsDTO(userNotificationSettingsService.findNotificationSettings(new PersonId(person.getId())).restrictToDepartments());
             final UserPaginationSettingsDTO userPaginationSettingsDTO = new UserPaginationSettingsDTO(userPaginationSettingsSupplier.getUserPaginationSettings(new PersonId(person.getId())).getDefaultPageSize());
             final UserSettings userSettingsForPerson = userSettingsService.getUserSettingsForPerson(person);
             final UserSettingsDTO userSettings = new UserSettingsDTO(ThemeDTO.valueOf(userSettingsForPerson.theme().name()), userSettingsForPerson.locale().orElse(null), userSettingsForPerson.localeBrowserSpecific().orElse(null), userNotificationSettingsDTO, userPaginationSettingsDTO);
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/mail/MailRecipientServiceImpl.java b/src/main/java/org/synyx/urlaubsverwaltung/mail/MailRecipientServiceImpl.java
index b0ceb8bac..87dde0451 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/mail/MailRecipientServiceImpl.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/mail/MailRecipientServiceImpl.java
@@ -112,8 +112,8 @@ class MailRecipientServiceImpl implements MailRecipientService {
         final Predicate<PersonId> departmentMatch = personId -> departmentService.hasDepartmentMatch(byPersonId.get(personId), personOfInterest);
 
         final List<PersonId> notInterestedIds = userNotificationSettingsService.findNotificationSettings(officeBossIds).values().stream()
-            .filter(UserNotificationSettings::isRestrictToDepartments)
-            .map(UserNotificationSettings::getPersonId)
+            .filter(UserNotificationSettings::restrictToDepartments)
+            .map(UserNotificationSettings::personId)
             .filter(not(departmentMatch))
             .toList();
 
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettings.java b/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettings.java
index 9a1ccad11..670d01161 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettings.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettings.java
@@ -2,41 +2,10 @@ package org.synyx.urlaubsverwaltung.notification;
 
 import org.synyx.urlaubsverwaltung.person.PersonId;
 
-import java.util.Objects;
-
 /**
  * Info about the notification configuration of a person.
  */
-public final class UserNotificationSettings {
-
-    private final PersonId personId;
-    private final boolean restrictToDepartments;
-
-    public UserNotificationSettings(PersonId personId, boolean restrictToDepartments) {
-        this.personId = personId;
-        this.restrictToDepartments = restrictToDepartments;
-    }
-
-    public PersonId getPersonId() {
-        return personId;
-    }
-
-    public boolean isRestrictToDepartments() {
-        return restrictToDepartments;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        UserNotificationSettings that = (UserNotificationSettings) o;
-        return restrictToDepartments == that.restrictToDepartments && Objects.equals(personId, that.personId);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(personId, restrictToDepartments);
-    }
+public record UserNotificationSettings(PersonId personId, boolean restrictToDepartments) {
 
     @Override
     public String toString() {
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImpl.java b/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImpl.java
index 574c26f82..80d60ad1e 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImpl.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImpl.java
@@ -34,14 +34,14 @@ class UserNotificationSettingsServiceImpl implements UserNotificationSettingsSer
 
         final Map<PersonId, UserNotificationSettings> notificationsByPerson = repository.findAllById(personIdValues).stream()
             .map(UserNotificationSettingsServiceImpl::toNotification)
-            .collect(toMap(UserNotificationSettings::getPersonId, identity(), (userNotificationSettings, userNotificationSettings2) -> userNotificationSettings));
+            .collect(toMap(UserNotificationSettings::personId, identity(), (userNotificationSettings, userNotificationSettings2) -> userNotificationSettings));
 
         final Stream<UserNotificationSettings> defaultNotificationSettings = personIds.stream()
             .filter(not(notificationsByPerson::containsKey))
             .map(UserNotificationSettingsServiceImpl::defaultNotificationSettings);
 
         return Stream.concat(notificationsByPerson.values().stream(), defaultNotificationSettings)
-            .collect(toMap(UserNotificationSettings::getPersonId, identity(), (userNotificationSettings, userNotificationSettings2) -> userNotificationSettings));
+            .collect(toMap(UserNotificationSettings::personId, identity(), (userNotificationSettings, userNotificationSettings2) -> userNotificationSettings));
     }
 
     @Override
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeService.java b/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeService.java
index f6ef20755..ec7b7a561 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeService.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeService.java
@@ -33,7 +33,7 @@ public interface OvertimeService {
      * @param author   identifies the person that recorded the overtime
      * @return the created overtime record
      */
-    Overtime record(Overtime overtime, Optional<String> comment, Person author);
+    Overtime save(Overtime overtime, Optional<String> comment, Person author);
 
 
     /**
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImpl.java b/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImpl.java
index 0a7af4dd6..d76564383 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImpl.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImpl.java
@@ -52,9 +52,14 @@ class OvertimeServiceImpl implements OvertimeService {
     private final Clock clock;
 
     @Autowired
-    public OvertimeServiceImpl(OvertimeRepository overtimeRepository, OvertimeCommentRepository overtimeCommentRepository,
-                               ApplicationService applicationService, OvertimeMailService overtimeMailService,
-                               SettingsService settingsService, Clock clock) {
+    public OvertimeServiceImpl(
+        OvertimeRepository overtimeRepository,
+        OvertimeCommentRepository overtimeCommentRepository,
+        ApplicationService applicationService,
+        OvertimeMailService overtimeMailService,
+        SettingsService settingsService,
+        Clock clock
+    ) {
         this.overtimeRepository = overtimeRepository;
         this.overtimeCommentRepository = overtimeCommentRepository;
         this.applicationService = applicationService;
@@ -71,7 +76,7 @@ class OvertimeServiceImpl implements OvertimeService {
     }
 
     @Override
-    public Overtime record(Overtime overtime, Optional<String> comment, Person author) {
+    public Overtime save(Overtime overtime, Optional<String> comment, Person author) {
 
         final boolean isNewOvertime = overtime.getId() == null;
 
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewController.java b/src/main/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewController.java
index 2c546b9fa..96d73556f 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewController.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewController.java
@@ -216,7 +216,7 @@ public class OvertimeViewController implements HasLaunchpad {
 
         final Overtime overtime = overtimeForm.generateOvertime();
         final Optional<String> overtimeFormComment = Optional.ofNullable(overtimeForm.getComment());
-        final Overtime recordedOvertime = overtimeService.record(overtime, overtimeFormComment, signedInUser);
+        final Overtime recordedOvertime = overtimeService.save(overtime, overtimeFormComment, signedInUser);
 
         redirectAttributes.addFlashAttribute("overtimeRecord", OvertimeCommentAction.CREATED.name());
         return "redirect:/web/overtime/" + recordedOvertime.getId();
@@ -262,7 +262,7 @@ public class OvertimeViewController implements HasLaunchpad {
         }
 
         overtimeForm.updateOvertime(overtime);
-        overtimeService.record(overtime, Optional.ofNullable(overtimeForm.getComment()), signedInUser);
+        overtimeService.save(overtime, Optional.ofNullable(overtimeForm.getComment()), signedInUser);
 
         redirectAttributes.addFlashAttribute("overtimeRecord", OvertimeCommentAction.EDITED.name());
         return "redirect:/web/overtime/" + id;
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
index f34237834..aeadc979f 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
@@ -92,7 +92,7 @@ public class PersonNotificationsViewController implements HasLaunchpad {
 
         final boolean userIsAllowedToSubmitSickNotes = settingsService.getSettings().getSickNoteSettings().getUserIsAllowedToSubmitSickNotes();
         final PersonNotificationsDto personNotificationsDto = mapToPersonNotificationsDto(person, userIsAllowedToSubmitSickNotes);
-        personNotificationsDto.setRestrictToDepartments(new PersonNotificationDto(person.hasAnyRole(OFFICE, BOSS), notificationSettings.isRestrictToDepartments()));
+        personNotificationsDto.setRestrictToDepartments(new PersonNotificationDto(person.hasAnyRole(OFFICE, BOSS), notificationSettings.restrictToDepartments()));
 
         model.addAttribute("isViewingOwnNotifications", Objects.equals(person.getId(), signedInUser.getId()));
         model.addAttribute("personNiceName", person.getNiceName());


Test patch:
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImplTest.java b/src/test/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImplTest.java
index e98276e5d..9b290e145 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImplTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/notification/UserNotificationSettingsServiceImplTest.java
@@ -41,8 +41,8 @@ class UserNotificationSettingsServiceImplTest {
         when(repository.findById(1L)).thenReturn(Optional.of(entity));
 
         final UserNotificationSettings actual = sut.findNotificationSettings(new PersonId(1L));
-        assertThat(actual.getPersonId()).isEqualTo(new PersonId(1L));
-        assertThat(actual.isRestrictToDepartments()).isTrue();
+        assertThat(actual.personId()).isEqualTo(new PersonId(1L));
+        assertThat(actual.restrictToDepartments()).isTrue();
     }
 
     @Test
@@ -51,8 +51,8 @@ class UserNotificationSettingsServiceImplTest {
         when(repository.findById(1L)).thenReturn(Optional.empty());
 
         final UserNotificationSettings actual = sut.findNotificationSettings(new PersonId(1L));
-        assertThat(actual.getPersonId()).isEqualTo(new PersonId(1L));
-        assertThat(actual.isRestrictToDepartments()).isFalse();
+        assertThat(actual.personId()).isEqualTo(new PersonId(1L));
+        assertThat(actual.restrictToDepartments()).isFalse();
     }
 
     @Test
@@ -62,8 +62,8 @@ class UserNotificationSettingsServiceImplTest {
 
         final UserNotificationSettings actual = sut.updateNotificationSettings(new PersonId(1L), true);
 
-        assertThat(actual.getPersonId()).isEqualTo(new PersonId(1L));
-        assertThat(actual.isRestrictToDepartments()).isTrue();
+        assertThat(actual.personId()).isEqualTo(new PersonId(1L));
+        assertThat(actual.restrictToDepartments()).isTrue();
 
         final ArgumentCaptor<UserNotificationSettingsEntity> captor = ArgumentCaptor.forClass(UserNotificationSettingsEntity.class);
         verify(repository).save(captor.capture());
@@ -83,7 +83,7 @@ class UserNotificationSettingsServiceImplTest {
         when(repository.findAllById(List.of(1L, 1L))).thenReturn(List.of(entity, entity));
 
         final Map<PersonId, UserNotificationSettings> notificationSettings = sut.findNotificationSettings(List.of(new PersonId(1L), new PersonId(1L)));
-        assertThat(notificationSettings.get(new PersonId(1L)).getPersonId()).isEqualTo(new PersonId(1L));
-        assertThat(notificationSettings.get(new PersonId(1L)).isRestrictToDepartments()).isTrue();
+        assertThat(notificationSettings.get(new PersonId(1L)).personId()).isEqualTo(new PersonId(1L));
+        assertThat(notificationSettings.get(new PersonId(1L)).restrictToDepartments()).isTrue();
     }
 }
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImplTest.java b/src/test/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImplTest.java
index f847ab9cf..b2f9dd050 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImplTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/overtime/OvertimeServiceImplTest.java
@@ -76,7 +76,7 @@ class OvertimeServiceImplTest {
         final Overtime overtime = new Overtime();
         final Person author = new Person();
 
-        sut.record(overtime, Optional.of("Foo Bar"), author);
+        sut.save(overtime, Optional.of("Foo Bar"), author);
 
         verify(overtimeRepository).save(overtime);
         verify(overtimeCommentRepository).save(any(OvertimeComment.class));
@@ -89,7 +89,7 @@ class OvertimeServiceImplTest {
         final Overtime overtime = new Overtime();
         when(overtimeRepository.save(overtime)).thenReturn(overtime);
 
-        final Overtime savedOvertime = sut.record(overtime, Optional.empty(), author);
+        final Overtime savedOvertime = sut.save(overtime, Optional.empty(), author);
         assertThat(savedOvertime.getLastModificationDate()).isEqualTo(LocalDate.now(clock));
     }
 
@@ -105,7 +105,7 @@ class OvertimeServiceImplTest {
         final OvertimeComment overtimeComment = new OvertimeComment();
         when(overtimeCommentRepository.save(any())).thenReturn(overtimeComment);
 
-        sut.record(overtime, Optional.of("Foo Bar"), author);
+        sut.save(overtime, Optional.of("Foo Bar"), author);
 
         verify(overtimeMailService, never()).sendOvertimeNotificationToApplicantFromManagement(overtime, overtimeComment, author);
         verify(overtimeMailService).sendOvertimeNotificationToApplicantFromApplicant(overtime, overtimeComment);
@@ -128,7 +128,7 @@ class OvertimeServiceImplTest {
         final OvertimeComment overtimeComment = new OvertimeComment();
         when(overtimeCommentRepository.save(any())).thenReturn(overtimeComment);
 
-        sut.record(overtime, Optional.of("Foo Bar"), author);
+        sut.save(overtime, Optional.of("Foo Bar"), author);
 
         verify(overtimeMailService, never()).sendOvertimeNotificationToApplicantFromApplicant(overtime, overtimeComment);
         verify(overtimeMailService).sendOvertimeNotificationToApplicantFromManagement(overtime, overtimeComment, author);
@@ -141,7 +141,7 @@ class OvertimeServiceImplTest {
         final Overtime overtime = new Overtime();
         final Person author = new Person();
 
-        sut.record(overtime, Optional.empty(), author);
+        sut.save(overtime, Optional.empty(), author);
 
         final ArgumentCaptor<OvertimeComment> commentCaptor = ArgumentCaptor.forClass(OvertimeComment.class);
         verify(overtimeCommentRepository).save(commentCaptor.capture());
@@ -158,7 +158,7 @@ class OvertimeServiceImplTest {
         overtime.setId(1L);
         final Person author = new Person();
 
-        sut.record(overtime, Optional.empty(), author);
+        sut.save(overtime, Optional.empty(), author);
 
         final ArgumentCaptor<OvertimeComment> commentCaptor = ArgumentCaptor.forClass(OvertimeComment.class);
         verify(overtimeCommentRepository).save(commentCaptor.capture());
@@ -175,7 +175,7 @@ class OvertimeServiceImplTest {
         final Overtime overtime = new Overtime();
         when(overtimeRepository.save(overtime)).thenReturn(overtime);
 
-        sut.record(overtime, Optional.empty(), author);
+        sut.save(overtime, Optional.empty(), author);
 
         final ArgumentCaptor<OvertimeComment> commentCaptor = ArgumentCaptor.forClass(OvertimeComment.class);
         verify(overtimeCommentRepository).save(commentCaptor.capture());
@@ -194,7 +194,7 @@ class OvertimeServiceImplTest {
         final Overtime overtime = new Overtime();
         when(overtimeRepository.save(overtime)).thenReturn(overtime);
 
-        sut.record(overtime, Optional.of("Foo"), author);
+        sut.save(overtime, Optional.of("Foo"), author);
 
         final ArgumentCaptor<OvertimeComment> commentCaptor = ArgumentCaptor.forClass(OvertimeComment.class);
         verify(overtimeCommentRepository).save(commentCaptor.capture());
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewControllerTest.java b/src/test/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewControllerTest.java
index e7571332c..791a168b0 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewControllerTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/overtime/web/OvertimeViewControllerTest.java
@@ -598,7 +598,7 @@ class OvertimeViewControllerTest {
 
         final Overtime overtime = new Overtime(overtimePerson, LocalDate.of(2019, 7, 2), LocalDate.of(2019, 7, 2), ofHours(10));
         overtime.setId(2L);
-        when(overtimeService.record(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
+        when(overtimeService.save(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
         when(overtimeService.isUserIsAllowedToWriteOvertime(overtimePerson, overtimePerson)).thenReturn(true);
 
         final ResultActions resultActions = perform(
@@ -626,7 +626,7 @@ class OvertimeViewControllerTest {
 
         final Overtime overtime = new Overtime(overtimePerson, LocalDate.of(2022, 3, 1), LocalDate.of(2022, 4, 28), ofHours(10));
         overtime.setId(2L);
-        when(overtimeService.record(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
+        when(overtimeService.save(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
         when(overtimeService.isUserIsAllowedToWriteOvertime(overtimePerson, overtimePerson)).thenReturn(true);
 
         final ResultActions resultActions = perform(
@@ -775,7 +775,7 @@ class OvertimeViewControllerTest {
 
         final Overtime overtime = new Overtime(signedInPerson, LocalDate.of(2019, 7, 2), LocalDate.of(2019, 7, 2), ofHours(10));
         overtime.setId(2L);
-        when(overtimeService.record(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
+        when(overtimeService.save(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
         when(overtimeService.isUserIsAllowedToWriteOvertime(signedInPerson, overtimePerson)).thenReturn(true);
 
         final ResultActions resultActions = perform(
@@ -804,7 +804,7 @@ class OvertimeViewControllerTest {
         final Overtime overtime = new Overtime(overtimePerson, LocalDate.of(2022, 3, 1), LocalDate.of(2022, 4, 28), ofHours(10));
         overtime.setId(2L);
         when(overtimeService.getOvertimeById(2L)).thenReturn(Optional.of(overtime));
-        when(overtimeService.record(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
+        when(overtimeService.save(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
         when(overtimeService.isUserIsAllowedToWriteOvertime(overtimePerson, overtimePerson)).thenReturn(true);
 
         final ResultActions resultActions = perform(
@@ -941,7 +941,7 @@ class OvertimeViewControllerTest {
         final Overtime overtime = new Overtime(overtimePerson, LocalDate.of(2019, 7, 2), LocalDate.of(2019, 7, 2), ofHours(10));
         overtime.setId(2L);
         when(overtimeService.getOvertimeById(2L)).thenReturn(Optional.of(overtime));
-        when(overtimeService.record(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
+        when(overtimeService.save(any(Overtime.class), any(Optional.class), any(Person.class))).thenReturn(overtime);
         when(overtimeService.isUserIsAllowedToWriteOvertime(signedInPerson, overtimePerson)).thenReturn(true);
 
         final ResultActions resultActions = perform(
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/person/PersonServiceIT.java b/src/test/java/org/synyx/urlaubsverwaltung/person/PersonServiceIT.java
index 0ba3d562e..2157d2aa2 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/person/PersonServiceIT.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/person/PersonServiceIT.java
@@ -111,7 +111,7 @@ class PersonServiceIT extends SingleTenantTestContainersBase {
 
         sickNoteCommentService.create(sickNoteWithCommentWithId, SickNoteCommentAction.COMMENTED, personWithId, "Test");
 
-        final Overtime overtimeRecord = overtimeService.record(new Overtime(personWithId, now, now, Duration.ZERO), Optional.empty(), personWithId);
+        final Overtime overtimeRecord = overtimeService.save(new Overtime(personWithId, now, now, Duration.ZERO), Optional.empty(), personWithId);
 
         final Department department = new Department();
         department.setName("department");