diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/ActionMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/ActionMapperTest.java index 978676fd2c..1509aa3fdb 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/ActionMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/ActionMapperTest.java @@ -44,9 +44,9 @@ void setup() { actionMapper = new ActionMapper(keyResultBusinessService); } - @DisplayName("toDto() should map Action to Dto") + @DisplayName("Should map action to dto when calling toDto() is called") @Test - void toDtoShouldMapActionToDto() { + void shouldMapActionToDtoWhenToDtoIsCalled() { // arrange Action action = Action.Builder.builder() // .withId(ID) // @@ -76,9 +76,9 @@ private void assertActionDto(Action expected, ActionDto actual) { assertEquals(expected.isWriteable(), actual.isWriteable()); } - @DisplayName("toActions() should map List of Dtos with KeyResultId to list of Actions.") + @DisplayName("Should map a list of dtos with key-result-id to a list of actions when calling toActions()") @Test - void toActionsShouldMapListOfDtosWithKeyResultIdToListOfActions() { + void shouldMapListOfDtosWithKeyResultIdToListOfActionsWhenToActionsIsCalled() { // arrange when(keyResultBusinessService.getEntityById(keyResult.getId())).thenReturn(keyResult); @@ -101,9 +101,9 @@ void toActionsShouldMapListOfDtosWithKeyResultIdToListOfActions() { assertListOfActionsWithKeyResultId(actionDtoList, actionList); } - @DisplayName("toActions() with KeyResult Parameter should map List of Dtos (without a KeyResultId) to list of Actions") + @DisplayName("Should map list of dtos (without a key-result-id) to a list of actions when toActions() is called with a Key-result parameter") @Test - void toActionsWithKeyResultParameterShouldMapListOfDtosToListOfActions() { + void shouldMapListOfDtosWithoutKeyResultIdToListOfActionsWhenToActionsIsCalledWithKeyResultParameter() { // arrange KeyResult keyResultParameter = KeyResultMetric.Builder.builder().withId(20L).build(); ActionDto actionDtoWithKeyResultIdIsNull = new ActionDto(ID, // diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java index 24975509f1..12726f910f 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java @@ -15,18 +15,18 @@ class AlignmentSelectionMapperTest { private final AlignmentSelectionMapper alignmentSelectionMapper = new AlignmentSelectionMapper(); - @DisplayName("toDto() should return an empty list when no objectives are found") + @DisplayName("Should return an empty list when no objectives are found in toDto()") @Test - void toDtoShouldReturnEmptyListWhenNoObjectiveFound() { + void shouldReturnEmptyListWhenNoObjectivesAreFoundInToDto() { List alignmentSelections = List.of(); List alignmentObjectiveDtos = alignmentSelectionMapper.toDto(alignmentSelections); assertTrue(alignmentObjectiveDtos.isEmpty()); } - @DisplayName("toDto() should return one element when a single objective is found") + @DisplayName("Should return one element when a single objective is found in toDto()") @Test - void toDtoShouldReturnOneElementWhenObjectiveFound() { + void shouldReturnOneElementWhenSingleObjectiveIsFoundInToDto() { List alignmentSelections = List.of(AlignmentSelection.Builder.builder() .withAlignmentSelectionId(AlignmentSelectionId.Builder.builder().withObjectiveId(1L).build()) .withTeamId(2L).withTeamName(TEAM_PUZZLE).withObjectiveTitle("Objective 1").build()); @@ -36,9 +36,9 @@ void toDtoShouldReturnOneElementWhenObjectiveFound() { assertEquals(0, alignmentObjectiveDtos.get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when an objective with a key result is found") + @DisplayName("Should return one element when an objective with a key result is found in toDto()") @Test - void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultFound() { + void shouldReturnOneElementWhenObjectiveWithKeyResultIsFoundInToDto() { List alignmentSelections = List.of(AlignmentSelection.Builder.builder() .withAlignmentSelectionId( AlignmentSelectionId.Builder.builder().withObjectiveId(1L).withKeyResultId(3L).build()) @@ -50,9 +50,9 @@ void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultFound() { assertEquals(1, alignmentObjectiveDtos.get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when an objective with multiple key results is found") + @DisplayName("Should return one element when an objective with multiple key results is found in toDto()") @Test - void toDtoShouldReturnOneElementWhenObjectiveWithTwoKeyResultsFound() { + void shouldReturnOneElementWhenObjectiveWithMultipleKeyResultsIsFoundInToDto() { List alignmentSelections = List.of( AlignmentSelection.Builder.builder() .withAlignmentSelectionId( @@ -70,9 +70,9 @@ void toDtoShouldReturnOneElementWhenObjectiveWithTwoKeyResultsFound() { assertEquals(2, alignmentObjectiveDtos.get(0).keyResults().size()); } - @DisplayName("toDto() should return multiple objectives with their respective key results") + @DisplayName("Should return multiple objectives with their respective key results in toDto()") @Test - void toDtoShouldReturnOneElementWhenTwoObjectivesWithKeyResultsFound() { + void shouldReturnMultipleObjectivesWithRespectiveKeyResultsInToDto() { List alignmentSelections = List.of( AlignmentSelection.Builder.builder() .withAlignmentSelectionId( diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/CompletedMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/CompletedMapperTest.java index e01ba1a3f0..87569cda6a 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/CompletedMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/CompletedMapperTest.java @@ -45,9 +45,9 @@ void setUp() { completedMapper = new CompletedMapper(objectiveMapper); } - @DisplayName("toDto() should map Completed to Dto") + @DisplayName("Should map completed to dto when calling toDto()") @Test - void toDtoShouldMapCompletedToDto() { + void shouldMapCompletedToDto() { // arrange var completed = Completed.Builder.builder() // .withId(COMPLETED_ID) // @@ -73,9 +73,9 @@ private void assertCompletedDto(Completed expected, CompletedDto actual) { assertEquals(expected.getObjective().getId(), actual.objective().id()); } - @DisplayName("toCompleted() should map Dto to Completed") + @DisplayName("Should map dto to completed when calling toCompleted()") @Test - void toCompletedShouldMapDtoToCompleted() { + void shouldMapDtoToCompleted() { // arrange var completedDto = CompletedDtoBuilder.builder().withId(COMPLETED_ID).withComment(COMPLETED_COMMENT) .withObjectiveDto(ObjectiveDtoBuilder.builder().withId(OBJECTIVE_ID).build()).build(); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/ObjectiveMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/ObjectiveMapperTest.java index 35ce1d1cc7..f8ef9594a1 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/ObjectiveMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/ObjectiveMapperTest.java @@ -57,9 +57,9 @@ void setup() { objectiveMapper = new ObjectiveMapper(teamBusinessService, quarterBusinessService); } - @DisplayName("toDto() should map Objective to Dto") + @DisplayName("Should map objective to dto when calling toDto()") @Test - void toDtoShouldMapObjectiveToDto() { + void shouldMapObjectiveToDto() { // arrange Objective objective = Objective.Builder.builder() // .withId(ID) // @@ -95,9 +95,9 @@ private void assertObjectiveDto(Objective expected, ObjectiveDto actual) { assertEquals(expected.getModifiedOn(), actual.modifiedOn()); } - @DisplayName("toObjective() should map Dto to Objective") + @DisplayName("Should map dto to objective when calling toObjective()") @Test - void toObjectiveShouldMapDtoToObjective() { + void shouldMapDtoToObjective() { // arrange when(teamBusinessService.getTeamById(TEAM_ID)).thenReturn(team); when(quarterBusinessService.getQuarterById(QUARTER_ID)).thenReturn(quarter); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java index 528af83050..3fa0d07524 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java @@ -30,18 +30,18 @@ class OverviewMapperTest { @InjectMocks private OverviewMapper overviewMapper; - @DisplayName("toDto() should return an empty list when no team is found") + @DisplayName("Should return an empty list when toDto() is called with no team found") @Test - void toDtoShouldReturnEmptyListWhenNoTeamFound() { + void shouldReturnEmptyListWhenToDtoIsCalledWithNoTeamFound() { List overviews = List.of(); List overviewDtos = overviewMapper.toDto(overviews); assertTrue(overviewDtos.isEmpty()); } - @DisplayName("toDto() should return one element when a team without objectives is found") + @DisplayName("Should return one element when toDto() is called with a team without objectives") @Test - void toDtoShouldReturnEmptyListWhenTeamFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithTeamWithoutObjectives() { List overviews = List.of(Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withTeamId(2L).build()).withTeamName(TEAM_PUZZLE).build()); List overviewDtos = overviewMapper.toDto(overviews); @@ -50,9 +50,9 @@ void toDtoShouldReturnEmptyListWhenTeamFound() { assertEquals(0, overviewDtos.get(0).objectives().size()); } - @DisplayName("toDto() should return one element when a single objective with a key result is found") + @DisplayName("Should return one element when toDto() is called with a single objective and no key-results") @Test - void toDtoShouldReturnOneElementWhenObjectiveFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithSingleObjectiveAndNoKeyResults() { List overviews = List.of(Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L).build()) .withTeamName(TEAM_PUZZLE).withObjectiveTitle("Objective 1").build()); @@ -63,9 +63,9 @@ void toDtoShouldReturnOneElementWhenObjectiveFound() { assertEquals(0, overviewDtos.get(0).objectives().get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when a single objective with a key result and check-ins is found") + @DisplayName("Should return one element when toDto() is called with a single objective and a key-result") @Test - void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithSingleObjectiveAndKeyResult() { List overviews = List.of(Overview.Builder.builder() .withOverviewId( OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L).withKeyResultId(3L).build()) @@ -78,9 +78,9 @@ void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultFound() { assertEquals(1, overviewDtos.get(0).objectives().get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when an objective with multiple key results and check-ins is found") + @DisplayName("Should return one element when toDto() is called with an objective having multiple key results and check-ins") @Test - void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultAndCheckInsFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithObjectiveHavingMultipleKeyResultsAndCheckIns() { List overviews = List.of(Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L).withKeyResultId(3L) .withCheckInId(4L).build()) @@ -93,9 +93,9 @@ void toDtoShouldReturnOneElementWhenObjectiveWithKeyResultAndCheckInsFound() { assertEquals(1, overviewDtos.get(0).objectives().get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when an objective with multiple key results and check-ins is found") + @DisplayName("Should return one element when toDto() is called with an objective having two key results and a check-in") @Test - void toDtoShouldReturnOneElementWhenObjectiveWithTwoKeyResultAndCheckInFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithObjectiveHavingTwoKeyResultsAndCheckIn() { List overviews = List.of( Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L) @@ -114,9 +114,9 @@ void toDtoShouldReturnOneElementWhenObjectiveWithTwoKeyResultAndCheckInFound() { assertEquals(2, overviewDtos.get(0).objectives().get(0).keyResults().size()); } - @DisplayName("toDto() should return one element when multiple objectives with key results and check-ins are found") + @DisplayName("Should return one element when toDto() is called with multiple objectives, key results, and check-ins") @Test - void toDtoShouldReturnOneElementWhenTwoObjectivesWithKeyResultAndCheckInFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithMultipleObjectivesKeyResultsAndCheckIns() { List overviews = List.of( Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L) @@ -153,9 +153,9 @@ void toDtoShouldReturnOneElementWhenTwoObjectivesWithKeyResultAndCheckInFound() assertEquals("checkIn", ((OverviewKeyResultOrdinalDto) keyResultDto).lastCheckIn().zone()); } - @DisplayName("toDto() should return one element when multiple teams with objectives and key results are found") + @DisplayName("Should return one element when toDto() is called with multiple teams having objectives and key-results") @Test - void toDtoShouldReturnOneElementWhenTwoTeamsWithObjectivesAndKeyResultsFound() { + void shouldReturnOneElementWhenToDtoIsCalledWithMultipleTeamsHavingObjectivesAndKeyResults() { List overviews = List.of( Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L) @@ -181,9 +181,9 @@ void toDtoShouldReturnOneElementWhenTwoTeamsWithObjectivesAndKeyResultsFound() { assertEquals(2, overviewDtos.get(1).objectives().get(0).keyResults().size()); } - @DisplayName("toDto() should throw an exception when a key result type is not supported") + @DisplayName("Should throw an exception when toDto() is called with an unsupported key result type") @Test - void toDtoShouldThrowExceptionWhenKeyResultTypeNotSupported() { + void shouldThrowExceptionWhenToDtoIsCalledWithUnsupportedKeyResultType() { List overviews = List.of(Overview.Builder.builder() .withOverviewId(OverviewId.Builder.builder().withObjectiveId(1L).withTeamId(2L).withKeyResultId(3L) .withCheckInId(4L).build()) diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/TeamMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/TeamMapperTest.java index 610bb686be..ee419a7858 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/TeamMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/TeamMapperTest.java @@ -21,9 +21,9 @@ public class TeamMapperTest { @InjectMocks private TeamMapper teamMapper; - @DisplayName("toDto() should map Team to Dto") + @DisplayName("Should map team to dto when calling toDto()") @Test - void toDtoShouldMapTeamToDto() { + void shouldMapTeamToDto() { // arrange Team team = Team.Builder.builder() // .withId(ID) // @@ -47,9 +47,9 @@ private static void assertTeamDto(Team expected, TeamDto actual) { assertEquals(expected.isWriteable(), actual.isWriteable()); } - @DisplayName("toTeam() should map Dto to Team") + @DisplayName("Should map dto to team when calling toTeam()") @Test - void toTeamShouldMapDtoToTeam() { + void shouldMapDtoToTeam() { // arrange TeamDto teamDto = new TeamDto(ID, VERSION, NAME, IS_WRITEABLE); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/UserMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/UserMapperTest.java index 4d6eb855ae..4d56d65be2 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/UserMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/UserMapperTest.java @@ -52,9 +52,9 @@ void setup() { userMapper = new UserMapper(teamMapper); } - @DisplayName("toDto() without TeamList throws NullPointerException") + @DisplayName("Should throw NullPointerException when toDto() is called without teamList") @Test - void toDtoWithoutTeamListThrowsException() { + void shouldThrowExceptionWhenToDtoIsCalledWithoutTeamList() { // arrange User user = User.Builder.builder() // .withId(ID) // @@ -69,9 +69,9 @@ void toDtoWithoutTeamListThrowsException() { assertThrows(NullPointerException.class, () -> userMapper.toDto(user)); } - @DisplayName("toDto() should map User to Dto") + @DisplayName("Should map User to Dto when toDto() is called") @Test - void toDtoShouldMapUserToDto() { + void shouldMapUserToDtoWhenToDtoIsCalled() { // act UserDto userDto = userMapper.toDto(user); @@ -80,9 +80,9 @@ void toDtoShouldMapUserToDto() { assertUserDto(user, userDto); } - @DisplayName("toDtos() should map list of Users to Dtos") + @DisplayName("Should map list of users to dtos when toDtos() is called") @Test - void toDtosShouldMapListOfUsersToDtos() { + void shouldMapListOfUsersToDtosWhenToDtosIsCalled() { // act List userDtos = userMapper.toDtos(List.of(user)); @@ -102,9 +102,9 @@ private void assertUserDto(User expected, UserDto actual) { assertEquals(expected.getUserTeamList().get(0).getId(), actual.userTeamList().get(0).id()); } - @DisplayName("toUser() should map UserDto to User") + @DisplayName("Should map user-dto to user when toUser() is called") @Test - void toUserShouldMapUserDtoToUser() { + void shouldMapUserDtoToUserWhenToUserIsCalled() { // act User user = userMapper.toUser(userDto); @@ -113,9 +113,9 @@ void toUserShouldMapUserDtoToUser() { assertUser(userDto, user); } - @DisplayName("toUserList() should map List of UserDtos to List of Users") + @DisplayName("Should map list of user-dtos to list of users when toUserList() is called") @Test - void toUserListShouldMapUserDtoListToUserList() { + void shouldMapUserDtoListToUserListWhenToUserListIsCalled() { // act List users = userMapper.toUserList(List.of(userDto)); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMapperTest.java index 514d838491..9af1a3e95a 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMapperTest.java @@ -43,9 +43,9 @@ void setup() { checkInMapper = new CheckInMapper(checkInMetricMapper, checkInOrdinalMapper); } - @DisplayName("toDto() should map CheckInMetric to CheckInMetricDto") + @DisplayName("Should map CheckInMetric to CheckInMetricDto when toDto() is called") @Test - void toDtoShouldMapCheckInMetricToCheckInMetricDto() { + void shouldMapCheckInMetricToCheckInMetricDtoWhenToDtoIsCalled() { // arrange CheckInMetric checkInMetric = TestDataHelper.checkInMetric(); @@ -56,9 +56,9 @@ void toDtoShouldMapCheckInMetricToCheckInMetricDto() { assertEquals(CheckInMetricDto.class, checkInDto.getClass()); } - @DisplayName("toDto() should map CheckInOrdinal to a CheckInOrdinalDto") + @DisplayName("Should map CheckInOrdinal to CheckInOrdinalDto when toDto() is called") @Test - void toDtoShouldMapCheckInOrdinalToCheckInOrdinalDto() { + void shouldMapCheckInOrdinalToCheckInOrdinalDtoWhenToDtoIsCalled() { // arrange CheckInOrdinal checkInOrdinal = TestDataHelper.checkInOrdinal(); @@ -69,9 +69,9 @@ void toDtoShouldMapCheckInOrdinalToCheckInOrdinalDto() { assertEquals(CheckInOrdinalDto.class, checkInDto.getClass()); } - @DisplayName("toCheckIn() should map Dto to CheckInMetric") + @DisplayName("Should map Dto to CheckInMetric when toCheckIn() is called") @Test - void toCheckInShouldMapDtoToCheckInMetric() { + void shouldMapDtoToCheckInMetricWhenToCheckInIsCalled() { // arrange KeyResult keyResult = TestDataHelper.keyResult(); when(keyResultBusinessService.getEntityById(keyResult.getId())).thenReturn(keyResult); @@ -85,9 +85,9 @@ void toCheckInShouldMapDtoToCheckInMetric() { assertEquals(CheckInMetric.class, check.getClass()); } - @DisplayName("toCheckIn() should map Dto to CheckInOrdinal") + @DisplayName("Should map Dto to CheckInOrdinal when toCheckIn() is called") @Test - void toCheckInShouldMapDtoToCheckInOrdinal() { + void shouldMapDtoToCheckInOrdinalWhenToCheckInIsCalled() { // arrange KeyResult keyResult = TestDataHelper.keyResult(); when(keyResultBusinessService.getEntityById(keyResult.getId())).thenReturn(keyResult); @@ -101,9 +101,9 @@ void toCheckInShouldMapDtoToCheckInOrdinal() { assertEquals(CheckInOrdinal.class, check.getClass()); } - @DisplayName("toDto() should throw Exception if CheckIn is not Metric or Ordinal") + @DisplayName("Should throw Exception if CheckIn is not Metric or Ordinal when toDto() is called") @Test - void toDtoShouldThrowExceptionIfCheckInIsNotMetricOrOrdinal() { + void shouldThrowExceptionIfCheckInIsNotMetricOrOrdinalWhenToDtoIsCalled() { // arrange CheckIn checkIn = new CheckIn() { }; @@ -115,9 +115,9 @@ void toDtoShouldThrowExceptionIfCheckInIsNotMetricOrOrdinal() { assertEquals(HttpStatus.BAD_REQUEST, responseStatusException.getStatusCode()); } - @DisplayName("toCheckIn() should throw Exception if CheckIn is not MetricDto or OrdinalDto") + @DisplayName("Should throw Exception if CheckIn is not MetricDto or OrdinalDto when toCheckIn() is called") @Test - void toCheckInShouldThrowExceptionIfCheckInIsNotMetricOrOrdinal() { + void shouldThrowExceptionIfCheckInIsNotMetricDtoOrOrdinalDtoWhenToCheckInIsCalled() { // arrange CheckInDto checkInDto = new CheckInDto() { }; diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMetricMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMetricMapperTest.java index 138391aa35..c89bdca7e2 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMetricMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInMetricMapperTest.java @@ -38,9 +38,9 @@ void setup() { checkInMetricMapper = new CheckInMetricMapper(keyResultBusinessService); } - @DisplayName("toDto() should map CheckInMetric to Dto") + @DisplayName("Should map check-in-metric to dto when calling toDto()") @Test - void toDtoShouldMapCheckInMetricToDto() { + void shouldMapCheckInMetricToDto() { // arrange CheckInMetric checkInMetric = checkInMetric(); @@ -52,9 +52,9 @@ void toDtoShouldMapCheckInMetricToDto() { assertCheckInMetricDto(checkInMetric, checkInMetricDto); } - @DisplayName("toCheckInMetric() should map Dto to checkInMetric") + @DisplayName("Should map dto to check-in-metric when calling toCheckInMetric()") @Test - void toCheckInMetricShouldMapDtoToCheckInMetric() { + void shouldMapDtoToCheckInMetric() { // arrange KeyResult keyResult = TestDataHelper.keyResult(); when(keyResultBusinessService.getEntityById(keyResult.getId())).thenReturn(keyResult); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInOrdinalMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInOrdinalMapperTest.java index 76a7900bcf..95e4f8b54a 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInOrdinalMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/checkin/CheckInOrdinalMapperTest.java @@ -38,9 +38,9 @@ void setup() { checkInOrdinalMapper = new CheckInOrdinalMapper(keyResultBusinessService); } - @DisplayName("toDto() should map CheckInOrdinal to Dto") + @DisplayName("Should map check-in-ordinal to dto when calling toDto()") @Test - void toDtoShouldMapCheckInOrdinalToDto() { + void shouldMapCheckInOrdinalToDto() { // arrange CheckInOrdinal checkInOrdinal = checkInOrdinal(); @@ -52,9 +52,9 @@ void toDtoShouldMapCheckInOrdinalToDto() { assertCheckInOrdinalDto(checkInOrdinal, checkInOrdinalDto); } - @DisplayName("toCheckInOrdinal() should map Dto to checkInOrdinal") + @DisplayName("Should map dto to check-in-ordinal when calling toCheckInOrdinal()") @Test - void toCheckInOrdinalShouldMapDtoToCheckInOrdinal() { + void shouldMapDtoToCheckInOrdinal() { // arrange KeyResult keyResult = TestDataHelper.keyResult(); when(keyResultBusinessService.getEntityById(keyResult.getId())).thenReturn(keyResult); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMapperTest.java index 8ba2235adc..9020c9dc5a 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMapperTest.java @@ -60,9 +60,9 @@ void setup() { keyResultMapper = new KeyResultMapper(keyResultOrdinalMapper, keyResultMetricMapper); } - @DisplayName("toDto() should map KeyResultMetric to KeyResultMetricDto") + @DisplayName("Should map KeyResultMetric to KeyResultMetricDto when toDto() is called") @Test - void toDtoShouldMapKeyResultMetricToKeyResultMetricDto() { + void shouldMapKeyResultMetricToKeyResultMetricDto() { // arrange KeyResultMetric keyResultMetric = keyResultMetric(); List actions = List.of(); @@ -74,9 +74,9 @@ void toDtoShouldMapKeyResultMetricToKeyResultMetricDto() { assertEquals(KeyResultMetricDto.class, keyResultDto.getClass()); } - @DisplayName("toDto() should map KeyResultOrdinal to KeyResultOrdinalDto") + @DisplayName("Should map KeyResultOrdinal to KeyResultOrdinalDto when toDto() is called") @Test - void toDtoShouldMapKeyResultOrdinalToKeyResultOrdinalDto() { + void shouldMapKeyResultOrdinalToKeyResultOrdinalDto() { // arrange KeyResultOrdinal keyResultOrdinal = keyResultOrdinal(); List actions = List.of(); @@ -88,9 +88,9 @@ void toDtoShouldMapKeyResultOrdinalToKeyResultOrdinalDto() { assertEquals(KeyResultOrdinalDto.class, keyResultDto.getClass()); } - @DisplayName("toKeyResult() should map KeyResultMetricDto to KeyResultMetric") + @DisplayName("Should map KeyResultMetricDto to KeyResultMetric when toKeyResult() is called") @Test - void toKeyResultShouldMapKeyResultMetricDtoToKeyResultMetric() { + void shouldMapKeyResultMetricDtoToKeyResultMetricWhenToKeyResultIsCalled() { // arrange KeyResultMetricDto keyResultMetricDto = keyResultMetricDto(); @@ -101,9 +101,9 @@ void toKeyResultShouldMapKeyResultMetricDtoToKeyResultMetric() { assertEquals(KeyResultMetric.class, keyResult.getClass()); } - @DisplayName("toKeyResult() should map KeyResultOrdinalDto to KeyResultOrdinal") + @DisplayName("Should map KeyResultOrdinalDto to KeyResultOrdinal when toKeyResult() is called") @Test - void toKeyResultShouldMapKeyResultOrdinalDtoToKeyResultOrdinal() { + void shouldMapKeyResultOrdinalDtoToKeyResultOrdinalWhenToKeyResultIsCalled() { // arrange KeyResultOrdinalDto keyResultOrdinalDto = keyResultOrdinalDto(); @@ -114,9 +114,9 @@ void toKeyResultShouldMapKeyResultOrdinalDtoToKeyResultOrdinal() { assertEquals(KeyResultOrdinal.class, keyResult.getClass()); } - @DisplayName("toDto() should throw Exception if KeyResult is not Metric or Ordinal") + @DisplayName("Should throw Exception if KeyResult is not Metric or Ordinal when toDto() is called") @Test - void toDtoShouldThrowExceptionIfKeyResultIsNotMetricOrOrdinal() { + void shouldThrowExceptionIfKeyResultIsNotMetricOrOrdinalWhenToDtoIsCalled() { // arrange KeyResult keyResult = new KeyResult() { }; @@ -129,9 +129,9 @@ void toDtoShouldThrowExceptionIfKeyResultIsNotMetricOrOrdinal() { assertEquals(HttpStatus.BAD_REQUEST, responseStatusException.getStatusCode()); } - @DisplayName("toKeyResult() should throw Exception if KeyResultDto is not MetricDto or OrdinalDto") + @DisplayName("Should throw Exception if KeyResultDto is not MetricDto or OrdinalDto when toKeyResult() is called") @Test - void toKeyResultShouldThrowExceptionIfKeyResultDtoIsNotMetricOrOrdinal() { + void shouldThrowExceptionIfKeyResultDtoIsNotMetricDtoOrOrdinalDtoWhenToKeyResultIsCalled() { // arrange KeyResultDto keyResultDto = List::of; diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMetricMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMetricMapperTest.java index e6efdb524e..c85bbc2e2d 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMetricMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultMetricMapperTest.java @@ -60,9 +60,9 @@ void setup() { actionMapper); } - @DisplayName("toDto() should map a KeyResultMetric to a Dto") + @DisplayName("Should map a KeyResultMetric to a Dto with CheckIn when toDto() is called") @Test - void toDtoShouldMapKeyResultMetricToDtoWithCheckIn() { + void shouldMapKeyResultMetricToDtoWithCheckInWhenToDtoIsCalled() { // arrange CheckIn checkIn = TestDataHelper.checkInMetric(); when(checkInBusinessService.getLastCheckInByKeyResultId(anyLong())).thenReturn(checkIn); @@ -79,9 +79,9 @@ void toDtoShouldMapKeyResultMetricToDtoWithCheckIn() { assertKeyResultMetricDtoWithCheckIn(keyResultMetric, keyResultMetricDto, actions); } - @DisplayName("toDto() should map KeyResultMetric to a Dto without CheckIn") + @DisplayName("Should map a KeyResultMetric to a Dto without CheckIn when toDto() is called") @Test - void toDtoShouldMapKeyResultMetricToDtoWithoutCheckIn() { + void shouldMapKeyResultMetricToDtoWithoutCheckInWhenToDtoIsCalled() { // arrange KeyResultMetric keyResultMetric = keyResultMetric(); List actions = List.of(action(keyResultMetric)); @@ -95,9 +95,9 @@ void toDtoShouldMapKeyResultMetricToDtoWithoutCheckIn() { assertKeyResultMetricDtoWithoutCheckIn(keyResultMetric, keyResultMetricDto, actions); } - @DisplayName("toKeyResultMetric() should map Dto to KeyResultMetric") + @DisplayName("Should map a Dto to KeyResultMetric when toKeyResultMetric() is called") @Test - void toKeyResultMetricShouldMapDtoToKeyResultMetric() { + void shouldMapDtoToKeyResultMetricWhenToKeyResultMetricIsCalled() { // arrange when(userBusinessService.getUserById(anyLong())).thenReturn(owner()); when(objectiveBusinessService.getEntityById(anyLong())).thenReturn(objective()); diff --git a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultOrdinalMapperTest.java b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultOrdinalMapperTest.java index dbc631e1d5..53e5fa928b 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultOrdinalMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/keyresult/KeyResultOrdinalMapperTest.java @@ -61,9 +61,9 @@ void setup() { actionMapper); } - @DisplayName("toDto() should map a KeyResultOrdinal with CheckIn to a Dto") + @DisplayName("Should map a key-result-ordinal with check-in to a dto when calling toDto()") @Test - void toDtoShouldMapKeyResultWithCheckInOrdinalToDto() { + void shouldMapKeyResultWithCheckInOrdinalToDto() { // arrange CheckIn checkIn = TestDataHelper.checkInOrdinal(); when(checkInBusinessService.getLastCheckInByKeyResultId(anyLong())).thenReturn(checkIn); @@ -80,9 +80,9 @@ void toDtoShouldMapKeyResultWithCheckInOrdinalToDto() { assertKeyResultOrdinalDtoWithCheckIn(keyResultOrdinal, keyResultOrdinalDto, actions); } - @DisplayName("toDto() should map a KeyResultOrdinal without CheckIn to a Dto") + @DisplayName("Should map a KeyResultOrdinal without CheckIn to a Dto when calling toDto()") @Test - void toDtoShouldMapKeyResultWithoutCheckInOrdinalToDto() { + void shouldMapKeyResultWithoutCheckInOrdinalToDto() { // arrange KeyResultOrdinal keyResultOrdinal = keyResultOrdinal(); List actions = List.of(action(keyResultOrdinal)); @@ -96,9 +96,9 @@ void toDtoShouldMapKeyResultWithoutCheckInOrdinalToDto() { assertKeyResultOrdinalDtoWithoutCheckIn(keyResultOrdinal, keyResultOrdinalDto, actions); } - @DisplayName("toKeyResultMetric() should map Dto to KeyResultMetric") + @DisplayName("Should map Dto to KeyResultMetric when calling toKeyResultMetric()") @Test - void toKeyResultMetricShouldMapDtoToKeyResultMetric() { + void shouldMapDtoToKeyResultMetric() { // arrange when(userBusinessService.getUserById(anyLong())).thenReturn(owner()); when(objectiveBusinessService.getEntityById(anyLong())).thenReturn(objective()); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/ActionPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/ActionPersistenceServiceIT.java index 5abaabceb8..85375b44b7 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/ActionPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/ActionPersistenceServiceIT.java @@ -63,7 +63,7 @@ void tearDown() { @DisplayName("Should create new entity on save()") @Test - void saveActionShouldSaveNewAction() { + void shouldCreateNewEntityWhenSaveIsCalled() { Action action = createAction(null); createdAction = actionPersistenceService.save(action); @@ -77,7 +77,7 @@ void saveActionShouldSaveNewAction() { @DisplayName("Should update action on save() when the action has been modified") @Test - void updateActionShouldUpdateAction() { + void shouldUpdateActionWhenSaveIsCalledWithModifiedAction() { Action action = createAction(null); createdAction = actionPersistenceService.save(action); createdAction.setAction(UPDATED_ACTION); @@ -92,7 +92,7 @@ void updateActionShouldUpdateAction() { @DisplayName("Should throw exception on save() when the action has already been updated") @Test - void updateActionShouldThrowExceptionWhenAlreadyUpdated() { + void shouldThrowExceptionWhenSaveIsCalledOnAlreadyUpdatedAction() { createdAction = actionPersistenceService.save(createAction(null)); Action changedAction = createAction(createdAction.getId(), 0); changedAction.setAction(UPDATED_ACTION); @@ -108,7 +108,7 @@ void updateActionShouldThrowExceptionWhenAlreadyUpdated() { @DisplayName("Should return list of all actions on findAll()") @Test - void getAllActionsShouldReturnListOfAllActions() { + void shouldReturnListOfAllActionsWhenFindAllIsCalled() { List actions = actionPersistenceService.findAll(); assertEquals(11, actions.size()); @@ -116,7 +116,7 @@ void getAllActionsShouldReturnListOfAllActions() { @DisplayName("Should return list of actions from a key result ordered by ascending priority on getActionsByKeyResultIdOrderByPriorityAsc()") @Test - void getAllActionsByKeyResultIdShouldReturnListOfAllActionsFromThisKeyResultOrderASC() { + void shouldReturnListOfActionsForKeyResultOrderedByPriorityWhenGetActionsByKeyResultIdOrderByPriorityAscIsCalled() { List actions = actionPersistenceService.getActionsByKeyResultIdOrderByPriorityAsc(6L); assertEquals(3, actions.size()); @@ -127,7 +127,7 @@ void getAllActionsByKeyResultIdShouldReturnListOfAllActionsFromThisKeyResultOrde @DisplayName("Should return correct action on findById()") @Test - void getActionByIdShouldReturnActionProperly() { + void shouldReturnCorrectActionWhenFindByIdIsCalled() { Action action = actionPersistenceService.findById(1L); assertEquals(1L, action.getId()); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentSelectionPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentSelectionPersistenceServiceIT.java index 6dc5cdeabb..d324809b80 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentSelectionPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentSelectionPersistenceServiceIT.java @@ -34,7 +34,7 @@ void tearDown() { @DisplayName("Should return correct alignment selections on getAlignmentSelectionByQuarterIdAndTeamIdNot()") @Test - void getAlignmentSelectionByQuarterIdAndTeamIdNotShouldReturnAlignmentSelections() { + void shouldReturnAlignmentSelections() { List alignmentSelections = alignmentSelectionPersistenceService .getAlignmentSelectionByQuarterIdAndTeamIdNot(2L, 4L); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/AuthorizationCriteriaIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/AuthorizationCriteriaIT.java index 417c08c14b..6717333d1c 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/AuthorizationCriteriaIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/AuthorizationCriteriaIT.java @@ -37,7 +37,7 @@ void tearDown() { @DisplayName("Should return objective on findObjectiveById() when user is has first level role") @Test - void appendObjectiveShouldReturnObjectiveWhenFirstLevelRole() { + void shouldReturnObjectiveWhenFindObjectiveByIdIsCalledByUserWithFirstLevelRole() { Long objectiveId = 5L; AuthorizationUser authorizationUser = defaultAuthorizationUser(); Objective objective = objectivePersistenceService.findObjectiveById(objectiveId, authorizationUser, null); @@ -47,7 +47,7 @@ void appendObjectiveShouldReturnObjectiveWhenFirstLevelRole() { @DisplayName("Should return objective on findObjectiveById() when user is has second level role") @Test - void appendObjectiveShouldReturnObjectiveWhenSecondLevelRole() { + void shouldReturnObjectiveWhenFindObjectiveByIdIsCalledByUserWithSecondLevelRole() { Long objectiveId = 6L; AuthorizationUser authorizationUser = mockAuthorizationUser(defaultUser(null)); Objective objective = objectivePersistenceService.findObjectiveById(objectiveId, authorizationUser, null); @@ -57,7 +57,7 @@ void appendObjectiveShouldReturnObjectiveWhenSecondLevelRole() { @DisplayName("Should return objective on findObjectiveById() when user is has member level role") @Test - void appendObjectiveShouldReturnObjectiveWhenMemberRole() { + void shouldReturnObjectiveWhenFindObjectiveByIdIsCalledByUserWithMemberLevelRole() { Long objectiveId = 6L; AuthorizationUser authorizationUser = mockAuthorizationUser(defaultUser(null)); Objective objective = objectivePersistenceService.findObjectiveById(objectiveId, authorizationUser, null); @@ -67,7 +67,7 @@ void appendObjectiveShouldReturnObjectiveWhenMemberRole() { @DisplayName("Should return correct overview on getFilteredOverview() when user has first level role and no team ids are supplied") @Test - void appendOverviewShouldReturnObjectiveWhenFirstLevelRoleAndTeamIdsEmpty() { + void shouldReturnCorrectOverviewWhenGetFilteredOverviewIsCalledByUserWithFirstLevelRoleAndNoTeamIdsSupplied() { Long quarterId = 2L; AuthorizationUser authorizationUser = defaultAuthorizationUser(); List overviews = overviewPersistenceService.getFilteredOverview(quarterId, List.of(), "", @@ -78,7 +78,7 @@ void appendOverviewShouldReturnObjectiveWhenFirstLevelRoleAndTeamIdsEmpty() { @DisplayName("Should return correct overview on getFilteredOverview() when user has second level role") @Test - void appendOverviewShouldReturnObjectiveWhenSecondLevelRole() { + void shouldReturnCorrectOverviewWhenGetFilteredOverviewIsCalledByUserWithSecondLevelRole() { Long quarterId = 2L; AuthorizationUser authorizationUser = mockAuthorizationUser(defaultUser(null)); List overviews = overviewPersistenceService.getFilteredOverview(quarterId, List.of(5L), "", @@ -89,7 +89,7 @@ void appendOverviewShouldReturnObjectiveWhenSecondLevelRole() { @DisplayName("Should return correct overview on getFilteredOverview() when user has member level role") @Test - void appendOverviewShouldReturnObjectiveWhenMemberRole() { + void shouldReturnCorrectOverviewWhenGetFilteredOverviewIsCalledByUserWithMemberLevelRole() { Long quarterId = 2L; AuthorizationUser authorizationUser = mockAuthorizationUser(defaultUser(null)); List overviews = overviewPersistenceService.getFilteredOverview(quarterId, List.of(5L), "", diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/CheckInPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/CheckInPersistenceServiceIT.java index 5ba06b88cd..f4ad5a1df5 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/CheckInPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/CheckInPersistenceServiceIT.java @@ -40,7 +40,7 @@ void tearDown() { // uses data from V100_0_0__TestData.sql @DisplayName("Should get checkIns by keyResultId and order them by date desc on getCheckInsByKeyResultIdOrderByCheckInDate() ") @Test - void getCheckInsByKeyResultIdOrderByCheckInDateShouldGetCheckInsByKeyResultIdAndOrderThemByDateDesc() { + void shouldGetCheckInsByKeyResultIdAndOrderThemByDateDesc() { // act List checkIns = checkInPersistenceService .getCheckInsByKeyResultIdOrderByCheckInDateDesc(KEY_RESULT_ID); @@ -59,7 +59,7 @@ private void assertFirstIsCreatedAfterSecond(CheckIn first, CheckIn second) { // uses data from V100_0_0__TestData.sql @DisplayName("Should get last checkIn of keyResult on getLastCheckInOfKeyResult()") @Test - void getLastCheckInOfKeyResultShouldGetLastCheckInOfKeyResult() { + void shouldGetLastCheckInOfKeyResult() { // act var lastCheckIn = checkInPersistenceService.getLastCheckInOfKeyResult(KEY_RESULT_ID); @@ -78,7 +78,7 @@ private void assertLastIsCreatedAfterAllOtherCheckIns(CheckIn last, List objectivePersistenceService .findObjectiveById(INVALID_OBJECTIVE_ID, authorizationUser, NO_RESULT_EXCEPTION)); @@ -100,7 +100,7 @@ void findObjectiveByIdShouldThrowExceptionWhenObjectiveNotFound() { @DisplayName("Should throw exception on findObjectiveById() when objective id is null") @Test - void findObjectiveByIdShouldThrowExceptionWhenObjectiveIdIsNull() { + void shouldThrowExceptionWhenObjectiveIdIsNullOnFindObjectiveById() { // act var exception = assertThrows(OkrResponseStatusException.class, () -> objectivePersistenceService.findObjectiveById(null, authorizationUser, NO_RESULT_EXCEPTION)); @@ -123,7 +123,7 @@ void shouldFindObjectiveByKeyResultId() { @DisplayName("Should throw exception on findObjectiveByKeyResultId() when objective not found") @Test - void findObjectiveByKeyResultIdShouldThrowExceptionWhenObjectiveNotFound() { + void shouldThrowExceptionWhenObjectiveNotFoundOnFindObjectiveByKeyResultId() { // act var exception = assertThrows(OkrResponseStatusException.class, () -> objectivePersistenceService .findObjectiveByKeyResultId(INVALID_KEY_RESULT_ID, authorizationUser, NO_RESULT_EXCEPTION)); @@ -135,7 +135,7 @@ void findObjectiveByKeyResultIdShouldThrowExceptionWhenObjectiveNotFound() { @DisplayName("Should throw exception on findObjectiveByKeyResultId() when objective id is null") @Test - void findObjectiveByKeyResultIdShouldThrowExceptionWhenObjectiveIdIsNull() { + void shouldThrowExceptionWhenObjectiveIdIsNullOnFindObjectiveByKeyResultId() { // act var exception = assertThrows(OkrResponseStatusException.class, () -> objectivePersistenceService .findObjectiveByKeyResultId(null, authorizationUser, NO_RESULT_EXCEPTION)); @@ -158,7 +158,7 @@ void shouldFindObjectiveByCheckInId() { @DisplayName("Should throw exception on findObjectiveByCheckInId() when objective not found") @Test - void findObjectiveByCheckInIdShouldThrowExceptionWhenObjectiveNotFound() { + void shouldThrowExceptionWhenObjectiveNotFoundOnFindObjectiveByCheckInId() { // act var exception = assertThrows(OkrResponseStatusException.class, () -> objectivePersistenceService .findObjectiveByCheckInId(INVALID_CHECK_IN_ID, authorizationUser, NO_RESULT_EXCEPTION)); @@ -170,7 +170,7 @@ void findObjectiveByCheckInIdShouldThrowExceptionWhenObjectiveNotFound() { @DisplayName("Should throw exception on findObjectiveByCheckInId() when objective id is null") @Test - void findObjectiveByCheckInIdShouldThrowExceptionWhenObjectiveIdIsNull() { + void shouldThrowExceptionWhenObjectiveIdIsNullOnFindObjectiveByCheckInId() { // act var exception = assertThrows(OkrResponseStatusException.class, () -> objectivePersistenceService .findObjectiveByCheckInId(null, authorizationUser, ObjectivePersistenceServiceIT.NO_RESULT_EXCEPTION)); @@ -195,7 +195,7 @@ void shouldFindObjectivesByTeamId() { @DisplayName("Should return empty list on findObjectiveByTeamId() when objective not found") @Test - void findObjectiveByTeamIdShouldReturnEmptyListWhenObjectiveNotFound() { + void shouldReturnEmptyListWhenObjectiveNotFoundOnFindObjectiveByTeamId() { // act var objectives = objectivePersistenceService.findObjectiveByTeamId(INVALID_TEAM_ID); @@ -205,7 +205,7 @@ void findObjectiveByTeamIdShouldReturnEmptyListWhenObjectiveNotFound() { @DisplayName("Should return empty list on findObjectiveByTeamId() when objective id is null") @Test - void findObjectiveByTeamIdShouldReturnEmptyListWhenObjectiveIdIsNull() { + void shouldReturnEmptyListWhenObjectiveIdIsNullOnFindObjectiveByTeamId() { // act var objectives = objectivePersistenceService.findObjectiveByTeamId(null); @@ -215,7 +215,7 @@ void findObjectiveByTeamIdShouldReturnEmptyListWhenObjectiveIdIsNull() { @DisplayName("Should return correct number of objectives for current quarter on findObjectiveByTeamId()") @Test - void countByTeamAndQuarterShouldReturnNumberOfObjectivesForCurrentQuarter() { + void shouldReturnNumberOfObjectivesForCurrentQuarterOnCountByTeamAndQuarter() { // arrange: there are 3 objectives for the current quarter (id 2) for team with id 6 var team = Team.Builder.builder().withId(ID_OF_TEAM_6).build(); var quarter = Quarter.Builder.builder().withId(CURRENT_QUARTER_ID).build(); @@ -261,7 +261,7 @@ private static Stream invalidTeamsAndQuarters() { @DisplayName("Should return objective on getModelName()") @Test - void getModelNameShouldReturnObjective() { + void shouldReturnObjectiveOnGetModelName() { assertEquals(OBJECTIVE, objectivePersistenceService.getModelName()); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java index d23db5bcc5..243cb526d9 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/KeyResultValidationServiceTest.java @@ -210,7 +210,7 @@ void shouldBeSuccessfulOnValidateOnUpdateWhenKeyResultIsValid() { @DisplayName("Should throw exception on validateOnUpdate() when model is null") @Test - void ShouldThrowExceptionOnValidateOnUpdateWhenModelIsNull() { + void shouldThrowExceptionOnValidateOnUpdateWhenModelIsNull() { // act + assert OkrResponseStatusException exception = assertThrows(OkrResponseStatusException.class, () -> validator.validateOnUpdate(1L, null)); @@ -310,7 +310,7 @@ void shouldBeSuccessfulOnValidateOnDeleteWhenValidKeyResultId() { @DisplayName("Should throw exception on validateOnDelete() when id is valid") @Test - void ShouldThrowExceptionOnValidateOnDeleteWhenKeyResultIdIsNull() { + void shouldThrowExceptionOnValidateOnDeleteWhenKeyResultIdIsNull() { // act + assert OkrResponseStatusException exception = assertThrows(OkrResponseStatusException.class, () -> validator.validateOnDelete(null)); diff --git a/backend/src/test/java/ch/puzzle/okr/util/quarter/check/QuarterRangeCheckerTest.java b/backend/src/test/java/ch/puzzle/okr/util/quarter/check/QuarterRangeCheckerTest.java index f4dea75458..fb5e7afd2e 100644 --- a/backend/src/test/java/ch/puzzle/okr/util/quarter/check/QuarterRangeCheckerTest.java +++ b/backend/src/test/java/ch/puzzle/okr/util/quarter/check/QuarterRangeCheckerTest.java @@ -11,9 +11,9 @@ public class QuarterRangeCheckerTest { - @DisplayName("nowIsInQuarter() should return false if Quarter is null") + @DisplayName("Should return false if Quarter is null when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnFalseIfQuarterIsNull() { + void shouldReturnFalseIfQuarterIsNullWhenNowIsInQuarterIsCalled() { // arrange Quarter quarter = null; LocalDate now = LocalDate.now(); @@ -22,9 +22,9 @@ void nowIsInQuarterShouldReturnFalseIfQuarterIsNull() { assertFalse(QuarterRangeChecker.nowIsInQuarter(now, quarter)); } - @DisplayName("nowIsInQuarter() should return false if now is null") + @DisplayName("Should return false if now is null when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnFalseIfNowIsNull() { + void shouldReturnFalseIfNowIsNullWhenNowIsInQuarterIsCalled() { // arrange Quarter quarter = Quarter.Builder.builder().build(); LocalDate now = null; @@ -33,9 +33,9 @@ void nowIsInQuarterShouldReturnFalseIfNowIsNull() { assertFalse(QuarterRangeChecker.nowIsInQuarter(now, quarter)); } - @DisplayName("nowIsInQuarter() should return true if now matches Quarter StartDate") + @DisplayName("Should return true if now matches Quarter StartDate when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnTrueIfNowMatchesQuarterStartDate() { + void shouldReturnTrueIfNowMatchesQuarterStartDateWhenNowIsInQuarterIsCalled() { // arrange LocalDate startDate = LocalDate.of(2024, 7, 1); Quarter quarter = quarter(startDate, null); @@ -46,9 +46,9 @@ void nowIsInQuarterShouldReturnTrueIfNowMatchesQuarterStartDate() { assertTrue(QuarterRangeChecker.nowIsInQuarter(nowMatchingQuarterStartDate, quarter)); } - @DisplayName("nowIsInQuarter() should return true if now matches Quarter EndDate") + @DisplayName("Should return true if now matches Quarter EndDate when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnTrueIfNowMatchesQuarterEndDate() { + void shouldReturnTrueIfNowMatchesQuarterEndDateWhenNowIsInQuarterIsCalled() { // arrange LocalDate startDate = LocalDate.of(2024, 7, 1); LocalDate endDate = LocalDate.of(2024, 9, 30); @@ -60,9 +60,9 @@ void nowIsInQuarterShouldReturnTrueIfNowMatchesQuarterEndDate() { assertTrue(QuarterRangeChecker.nowIsInQuarter(nowMatchingQuarterEndDate, quarter)); } - @DisplayName("nowIsInQuarter() should return true if now is between Quarter StartDate and EndDate") + @DisplayName("Should return true if now is between Quarter StartDate and EndDate when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnTrueIfNowIsBetweenQuarterStartDateAndEndDate() { + void shouldReturnTrueIfNowIsBetweenQuarterStartDateAndEndDateWhenNowIsInQuarterIsCalled() { // arrange LocalDate startDate = LocalDate.of(2024, 7, 1); LocalDate endDate = LocalDate.of(2024, 9, 30); @@ -74,9 +74,9 @@ void nowIsInQuarterShouldReturnTrueIfNowIsBetweenQuarterStartDateAndEndDate() { assertTrue(QuarterRangeChecker.nowIsInQuarter(nowBetweenQuarterStartEndDate, quarter)); } - @DisplayName("nowIsInQuarter() should return false if now is before Quarter StartDate") + @DisplayName("Should return false if now is before Quarter StartDate when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnFalseIfNowIsBeforeQuarterStartDate() { + void shouldReturnFalseIfNowIsBeforeQuarterStartDateWhenNowIsInQuarterIsCalled() { // arrange LocalDate startDate = LocalDate.of(2024, 7, 1); LocalDate endDate = LocalDate.of(2024, 9, 30); @@ -88,9 +88,9 @@ void nowIsInQuarterShouldReturnFalseIfNowIsBeforeQuarterStartDate() { assertFalse(QuarterRangeChecker.nowIsInQuarter(nowBeforeQuarterStartDate, quarter)); } - @DisplayName("nowIsInQuarter() should return false if now is after Quarter EndDate") + @DisplayName("Should return false if now is after Quarter EndDate when nowIsInQuarter() is called") @Test - void nowIsInQuarterShouldReturnFalseIfNowIsAfterQuarterEndDate() { + void shouldReturnFalseIfNowIsAfterQuarterEndDateWhenNowIsInQuarterIsCalled() { // arrange LocalDate startDate = LocalDate.of(2024, 7, 1); LocalDate endDate = LocalDate.of(2024, 9, 30); diff --git a/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/QuartersTest.java b/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/QuartersTest.java index e4fd5be7a4..f161b924c8 100644 --- a/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/QuartersTest.java +++ b/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/QuartersTest.java @@ -146,9 +146,9 @@ private static Stream pastDatesAndLabels() { "('GJ 24/25-Q2', '2024-10-01', '2024-12-31')")); } - @DisplayName("currentQuarter() should throw exception if no matching quarter is found for now") + @DisplayName("Should throw exception if no matching quarter is found when calling currentQuarter()") @Test - void currentQuarterShouldThrowExceptionIfNoMatchingQuarterIsFoundForNow() { + void shouldThrowExceptionIfNoMatchingQuarterIsFoundForNow() { // arrange LocalDate now = LocalDate.of(2024, 7, 15); Quarters allQuartersOfCurrentYear = new Quarters(now.getYear()); diff --git a/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/h2/QuarterFunctionTest.java b/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/h2/QuarterFunctionTest.java index 232c7c1337..0d70acae00 100644 --- a/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/h2/QuarterFunctionTest.java +++ b/backend/src/test/java/ch/puzzle/okr/util/quarter/generate/h2/QuarterFunctionTest.java @@ -8,9 +8,9 @@ public class QuarterFunctionTest { - @DisplayName("QuarterFunction should return correct current quarter data") + @DisplayName("Should return correct current quarter data") @Test - void quarterFunctionShouldReturnCorrectCurrentQuarterData() { + void shouldReturnCorrectCurrentQuarterData() { // arrange initQuarterData(); @@ -25,9 +25,9 @@ void quarterFunctionShouldReturnCorrectCurrentQuarterData() { assertEquals(expectedCurrent, currentQuarter); } - @DisplayName("QuarterFunction should return correct next quarter data") + @DisplayName("Should return correct next quarter data") @Test - void quarterFunctionShouldReturnCorrectNextQuarterData() { + void shouldReturnCorrectNextQuarterData() { // arrange initQuarterData();