diff --git a/backend/src/main/java/ch/puzzle/okr/deserializer/KeyResultDeserializer.java b/backend/src/main/java/ch/puzzle/okr/deserializer/KeyResultDeserializer.java index 45e499c0be..d873168391 100644 --- a/backend/src/main/java/ch/puzzle/okr/deserializer/KeyResultDeserializer.java +++ b/backend/src/main/java/ch/puzzle/okr/deserializer/KeyResultDeserializer.java @@ -23,9 +23,11 @@ public KeyResultDto deserialize(JsonParser jsonParser, DeserializationContext de throws IOException, JacksonException { ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec(); ObjectNode root = mapper.readTree(jsonParser); - if (root.has("keyResultType") && root.get("keyResultType").asText().equals(KEY_RESULT_TYPE_METRIC)) { + String keyResultAttribute = "keyResultType"; + if (root.has(keyResultAttribute) && root.get(keyResultAttribute).asText().equals(KEY_RESULT_TYPE_METRIC)) { return mapper.readValue(root.toString(), KeyResultMetricDto.class); - } else if (root.has("keyResultType") && root.get("keyResultType").asText().equals(KEY_RESULT_TYPE_ORDINAL)) { + } else if (root.has(keyResultAttribute) + && root.get(keyResultAttribute).asText().equals(KEY_RESULT_TYPE_ORDINAL)) { return mapper.readValue(root.toString(), KeyResultOrdinalDto.class); } throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "unsupported keyResult DTO to deserialize"); diff --git a/backend/src/main/java/ch/puzzle/okr/models/alignment/AlignmentSelection.java b/backend/src/main/java/ch/puzzle/okr/models/alignment/AlignmentSelection.java index 56bec32334..5c74cacc19 100644 --- a/backend/src/main/java/ch/puzzle/okr/models/alignment/AlignmentSelection.java +++ b/backend/src/main/java/ch/puzzle/okr/models/alignment/AlignmentSelection.java @@ -91,6 +91,7 @@ public static final class Builder { private String keyResultTitle; public Builder() { + // This builder can be empty, so that it can get called } public static Builder builder() { diff --git a/backend/src/main/java/ch/puzzle/okr/models/keyresult/KeyResult.java b/backend/src/main/java/ch/puzzle/okr/models/keyresult/KeyResult.java index 930cd3eefa..4ebb0554bc 100644 --- a/backend/src/main/java/ch/puzzle/okr/models/keyresult/KeyResult.java +++ b/backend/src/main/java/ch/puzzle/okr/models/keyresult/KeyResult.java @@ -166,7 +166,7 @@ public abstract static class Builder { private LocalDateTime modifiedOn; private String keyResultType; - public Builder(String keyResultType) { + protected Builder(String keyResultType) { this.keyResultType = keyResultType; } diff --git a/backend/src/test/java/ch/puzzle/okr/KeyResultTestHelpers.java b/backend/src/test/java/ch/puzzle/okr/KeyResultTestHelpers.java index 43a7263e46..5d81cc3a3e 100644 --- a/backend/src/test/java/ch/puzzle/okr/KeyResultTestHelpers.java +++ b/backend/src/test/java/ch/puzzle/okr/KeyResultTestHelpers.java @@ -15,8 +15,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.List; import static ch.puzzle.okr.Constants.KEY_RESULT_TYPE_METRIC; import static ch.puzzle.okr.Constants.KEY_RESULT_TYPE_ORDINAL; @@ -84,8 +82,6 @@ public class KeyResultTestHelpers { public static final CheckIn checkIn2 = CheckInMetric.Builder.builder().withValue(12D).withId(4L) .withKeyResult(metricKeyResult).withCreatedBy(user).withCreatedOn(LocalDateTime.MAX) .withChangeInfo(CHANGE_INFO_2).withInitiatives(INITIATIVES_2).build(); - public static final List checkInList = Arrays.asList(checkIn1, checkIn2); - public static final CheckInDto checkInDto1 = new CheckInMetricDto(1L, CHANGE_INFO_1, INITIATIVES_1, 6, metricKeyResult.getId(), LocalDateTime.MAX, LocalDateTime.MAX, 23D); public static final CheckInDto checkInDto2 = new CheckInMetricDto(4L, CHANGE_INFO_2, INITIATIVES_2, 5, diff --git a/backend/src/test/java/ch/puzzle/okr/OverviewTestHelper.java b/backend/src/test/java/ch/puzzle/okr/OverviewTestHelper.java index 29588912fd..97fe9151ed 100644 --- a/backend/src/test/java/ch/puzzle/okr/OverviewTestHelper.java +++ b/backend/src/test/java/ch/puzzle/okr/OverviewTestHelper.java @@ -3,8 +3,12 @@ import java.util.List; public class OverviewTestHelper { - public static final long quarterId = 1L; - public static final long teamId = 1L; + public static final long QUARTER_ID = 1L; + public static final long TEAM_ID = 1L; public static final List teamIds = List.of(1L, 2L, 3L, 4L); + + private OverviewTestHelper() { + throw new IllegalStateException("Utility class"); + } } diff --git a/backend/src/test/java/ch/puzzle/okr/controller/AlignmentControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/AlignmentControllerIT.java index 93d2371629..c0372930db 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/AlignmentControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/AlignmentControllerIT.java @@ -30,7 +30,7 @@ @WithMockUser(value = "spring") @ExtendWith(MockitoExtension.class) @WebMvcTest(AlignmentController.class) -public class AlignmentControllerIT { +class AlignmentControllerIT { @Autowired private MockMvc mvc; @MockBean @@ -38,6 +38,7 @@ public class AlignmentControllerIT { @SpyBean private AlignmentSelectionMapper alignmentSelectionMapper; + static String alignmentObjectiveName = "Objective 5"; static List alignmentSelectionPuzzle = List.of( AlignmentSelection.Builder.builder().withAlignmentSelectionId(AlignmentSelectionId.of(1L, 20L)) .withObjectiveTitle("Objective 1").withKeyResultTitle("KeyResult 20").build(), @@ -45,13 +46,13 @@ public class AlignmentControllerIT { .withObjectiveTitle("Objective 1").withKeyResultTitle("KeyResult 40").build()); static List alignmentSelectionOKR = List.of( AlignmentSelection.Builder.builder().withAlignmentSelectionId(AlignmentSelectionId.of(5L, 21L)) - .withObjectiveTitle("Objective 5").withKeyResultTitle("KeyResult 21").build(), + .withObjectiveTitle(alignmentObjectiveName).withKeyResultTitle("KeyResult 21").build(), AlignmentSelection.Builder.builder().withAlignmentSelectionId(AlignmentSelectionId.of(5L, 41L)) - .withObjectiveTitle("Objective 5").withKeyResultTitle("KeyResult 41").build(), + .withObjectiveTitle(alignmentObjectiveName).withKeyResultTitle("KeyResult 41").build(), AlignmentSelection.Builder.builder().withAlignmentSelectionId(AlignmentSelectionId.of(5L, 61L)) - .withObjectiveTitle("Objective 5").withKeyResultTitle("KeyResult 61").build(), + .withObjectiveTitle(alignmentObjectiveName).withKeyResultTitle("KeyResult 61").build(), AlignmentSelection.Builder.builder().withAlignmentSelectionId(AlignmentSelectionId.of(5L, 81L)) - .withObjectiveTitle("Objective 5").withKeyResultTitle("KeyResult 81").build()); + .withObjectiveTitle(alignmentObjectiveName).withKeyResultTitle("KeyResult 81").build()); static AlignmentSelection alignmentSelectionEmptyKeyResults = AlignmentSelection.Builder.builder() .withAlignmentSelectionId(AlignmentSelectionId.of(8L, null)).withObjectiveTitle("Objective 8").build(); diff --git a/backend/src/test/java/ch/puzzle/okr/controller/CacheControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/CacheControllerIT.java index 00a493427e..462f3a5f43 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/CacheControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/CacheControllerIT.java @@ -19,7 +19,7 @@ @WithMockUser(value = "spring") @ExtendWith(MockitoExtension.class) @WebMvcTest(CacheController.class) -public class CacheControllerIT { +class CacheControllerIT { @Autowired private MockMvc mvc; @MockBean diff --git a/backend/src/test/java/ch/puzzle/okr/controller/CheckInControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/CheckInControllerIT.java index d6e9c0b01d..93e1736bba 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/CheckInControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/CheckInControllerIT.java @@ -149,7 +149,7 @@ void shouldCreateCheckInOrdinal() throws Exception { } @Test - void shouldThrowException_WhenKeyResultIdMissing() throws Exception { + void shouldThrowExceptionWhenKeyResultIdMissing() throws Exception { BDDMockito.given(keyResultBusinessService.getKeyResultById(anyLong())) .willReturn(KeyResultMetric.Builder.builder().withId(1L).build()); BDDMockito.given(checkInBusinessService.createCheckIn(any(), any())).willReturn(checkInOrdinal); diff --git a/backend/src/test/java/ch/puzzle/okr/controller/ClientConfigControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/ClientConfigControllerIT.java index 874e69617c..f76100bf79 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/ClientConfigControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/ClientConfigControllerIT.java @@ -19,7 +19,7 @@ @WithMockUser(value = "spring") @ExtendWith(MockitoExtension.class) @WebMvcTest(ClientConfigController.class) -public class ClientConfigControllerIT { +class ClientConfigControllerIT { @Autowired private MockMvc mvc; @MockBean diff --git a/backend/src/test/java/ch/puzzle/okr/controller/CompleteControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/CompleteControllerIT.java index fe4a370f42..ba8bf2afc0 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/CompleteControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/CompleteControllerIT.java @@ -42,7 +42,7 @@ class CompleteControllerIT { .withObjective(Objective.Builder.builder().withId(3L).withTitle("Gute Lernende").build()) .withComment("Wir haben es gut geschafft").build(); - public static final String createBodySuccessful = """ + public static final String SUCCESSFUL_CREATE_BODY = """ { "id":null, "objectiveId":3, @@ -56,7 +56,7 @@ class CompleteControllerIT { void createSuccessfulCompleted() throws Exception { BDDMockito.given(this.completedBusinessService.createCompleted((any()))).willReturn(successfulCompleted); - mvc.perform(post(baseUrl).content(createBodySuccessful).contentType(MediaType.APPLICATION_JSON) + mvc.perform(post(baseUrl).content(SUCCESSFUL_CREATE_BODY).contentType(MediaType.APPLICATION_JSON) .with(SecurityMockMvcRequestPostProcessors.csrf())) .andExpect(MockMvcResultMatchers.status().is2xxSuccessful()).andExpect(jsonPath(JSON_PATH_ID, Is.is(1))) .andExpect(jsonPath("$.objective.id", Is.is(3))) diff --git a/backend/src/test/java/ch/puzzle/okr/controller/KeyResultControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/KeyResultControllerIT.java index 56469b6432..8db04cdb8f 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/KeyResultControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/KeyResultControllerIT.java @@ -2,6 +2,7 @@ import ch.puzzle.okr.mapper.checkin.CheckInMapper; import ch.puzzle.okr.mapper.keyresult.KeyResultMapper; +import ch.puzzle.okr.models.checkin.CheckIn; import ch.puzzle.okr.service.business.KeyResultBusinessService; import ch.puzzle.okr.service.persistence.ObjectivePersistenceService; import ch.puzzle.okr.service.persistence.UserPersistenceService; @@ -23,7 +24,9 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.web.server.ResponseStatusException; +import java.util.Arrays; import java.util.Collections; +import java.util.List; import static ch.puzzle.okr.Constants.KEY_RESULT_TYPE_METRIC; import static ch.puzzle.okr.Constants.KEY_RESULT_TYPE_ORDINAL; @@ -111,6 +114,7 @@ void shouldNotFindTheKeyResultWithGivenId() throws Exception { @Test void shouldReturnCheckInsFromKeyResult() throws Exception { + List checkInList = Arrays.asList(checkIn1, checkIn2); BDDMockito.given(this.keyResultBusinessService.getAllCheckInsByKeyResult(5)).willReturn(checkInList); BDDMockito.given(this.checkInMapper.toDto(checkIn1)).willReturn(checkInDto1); BDDMockito.given(this.checkInMapper.toDto(checkIn2)).willReturn(checkInDto2); @@ -187,14 +191,14 @@ void createOrdinalKeyResult() throws Exception { } @Test - void shouldThrowException_WhenKeyResultTypeMissing() throws Exception { + void shouldThrowExceptionWhenKeyResultTypeMissing() throws Exception { mvc.perform(post(URL_BASE).content(CREATE_BODY_KEY_RESULT_TYPE_MISSING).contentType(MediaType.APPLICATION_JSON) .with(SecurityMockMvcRequestPostProcessors.csrf())) .andExpect(MockMvcResultMatchers.status().is4xxClientError()); } @Test - void shouldThrowException_WhenKeyResultTypeUnknown() throws Exception { + void shouldThrowExceptionWhenKeyResultTypeUnknown() throws Exception { mvc.perform(post(URL_BASE).content(CREATE_BODY_KEY_RESULT_TYPE_UNKNOWN).contentType(MediaType.APPLICATION_JSON) .with(SecurityMockMvcRequestPostProcessors.csrf())) .andExpect(MockMvcResultMatchers.status().is4xxClientError()); diff --git a/backend/src/test/java/ch/puzzle/okr/controller/OverviewControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/OverviewControllerIT.java index a012bccde5..67e9066cc1 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/OverviewControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/OverviewControllerIT.java @@ -37,7 +37,7 @@ @WithMockUser(value = "spring") @ExtendWith(MockitoExtension.class) @WebMvcTest(OverviewController.class) -public class OverviewControllerIT { +class OverviewControllerIT { @Autowired private MockMvc mvc; @MockBean @@ -79,13 +79,13 @@ public class OverviewControllerIT { .withCheckInValue(15.0).withConfidence(5).withCreatedOn(LocalDateTime.now()).build()); static Overview overviewKuchen = Overview.Builder.builder().withOverviewId(OverviewId.of(3L, 8L, 20L, 40L)) - .withTeamName("Kuchen").withObjectiveTitle("Objective 8").withObjectiveState(ONGOING).withQuarterId(1L) + .withTeamName(TEAM_KUCHEN).withObjectiveTitle("Objective 8").withObjectiveState(ONGOING).withQuarterId(1L) .withQuarterLabel(QUARTER_LABEL).withKeyResultTitle(DESCRIPTION).withKeyResultType(KEY_RESULT_TYPE_METRIC) .withUnit(CHF).withBaseline(5.0).withStretchGoal(20.0).withCheckInValue(15.0).withConfidence(5) .withCreatedOn(LocalDateTime.now()).build(); - static Overview overviewFindus = Overview.Builder.builder().withOverviewId(OverviewId.of(4L, -1L, -1L, -1L)) - .withTeamName("Findus").build(); + static Overview simpleOverview = Overview.Builder.builder().withOverviewId(OverviewId.of(4L, -1L, -1L, -1L)) + .withTeamName(TEAM_KUCHEN).build(); @BeforeEach void setUp() { @@ -144,12 +144,12 @@ void shouldReturnOnlyFilteredObjectivesByQuarterAndTeam() throws Exception { @Test void shouldReturnTeamWithEmptyObjectiveListWhenNoObjectiveInFilteredQuarter() throws Exception { BDDMockito.given(overviewBusinessService.getOverviewByQuarterIdAndTeamIds(2L, List.of(4L))) - .willReturn(List.of(overviewFindus)); + .willReturn(List.of(simpleOverview)); mvc.perform(get("/api/v2/overview?quarter=2&team=4").contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$", Matchers.hasSize(1))) .andExpect(jsonPath(JSON_PATH_TEAM_ID, Is.is(4))) - .andExpect(jsonPath(JSON_PATH_TEAM_NAME, Is.is("Findus"))) + .andExpect(jsonPath(JSON_PATH_TEAM_NAME, Is.is(TEAM_KUCHEN))) .andExpect(jsonPath("$[0].objectives.size()", Is.is(0))); } } 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 a0f746975f..85bbe148d4 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/AlignmentSelectionMapperTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class AlignmentSelectionMapperTest { +class AlignmentSelectionMapperTest { private final AlignmentSelectionMapper alignmentSelectionMapper = new AlignmentSelectionMapper(); @Test 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 ea775869e4..3ab9812ccc 100644 --- a/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java +++ b/backend/src/test/java/ch/puzzle/okr/mapper/OverviewMapperTest.java @@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.*; import static org.springframework.http.HttpStatus.BAD_REQUEST; -public class OverviewMapperTest { +class OverviewMapperTest { private final OverviewMapper overviewMapper = new OverviewMapper(); @Test diff --git a/backend/src/test/java/ch/puzzle/okr/service/CacheServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/CacheServiceIT.java index b6d1291559..cb83854b37 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/CacheServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/CacheServiceIT.java @@ -48,7 +48,7 @@ private static User createUser() { } @Test - void emptyUsersCache_ShouldClearUserCache() { + void emptyUsersCacheShouldClearUserCache() { createdUser = userPersistenceService.getOrCreateUser(createUser()); User userBeforeClearCache = cache.get(USERNAME, User.class); @@ -60,7 +60,7 @@ void emptyUsersCache_ShouldClearUserCache() { } @Test - void emptyAllCaches_ShouldClearAllCaches() { + void emptyAllCachesShouldClearAllCaches() { createdUser = userPersistenceService.getOrCreateUser(createUser()); User userBeforeClearCache = cache.get(USERNAME, User.class); diff --git a/backend/src/test/java/ch/puzzle/okr/service/ClientConfigServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/ClientConfigServiceIT.java index d27b090c21..04e536d88f 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/ClientConfigServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/ClientConfigServiceIT.java @@ -9,13 +9,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SpringIntegrationTest -public class ClientConfigServiceIT { +class ClientConfigServiceIT { @Autowired private ClientConfigService clientConfigService; @Test - void saveKeyResult_ShouldSaveNewKeyResult() { + void saveKeyResultShouldSaveNewKeyResult() { Map configMap = clientConfigService.getConfigBasedOnActiveEnv(); assertEquals("prod", configMap.get("activeProfile")); diff --git a/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java index 11bb43a74e..4f29c9c3db 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/business/AlignmentSelectionBusinessServiceTest.java @@ -15,7 +15,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class AlignmentSelectionBusinessServiceTest { +class AlignmentSelectionBusinessServiceTest { @InjectMocks AlignmentSelectionBusinessService alignmentSelectionBusinessService; diff --git a/backend/src/test/java/ch/puzzle/okr/service/business/KeyResultBusinessServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/business/KeyResultBusinessServiceIT.java index e43e714d83..92cb9c05bb 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/business/KeyResultBusinessServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/business/KeyResultBusinessServiceIT.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SpringIntegrationTest -public class KeyResultBusinessServiceIT { +class KeyResultBusinessServiceIT { private static final String KEY_RESULT_UPDATED = "Updated Key Result"; private static final Jwt jwtToken = mockJwtToken("findus", "Findus", "Peterson", "peterson@puzzle.ch"); @@ -79,7 +79,7 @@ void tearDown() { } @Test - void updateKeyResult_shouldUpdateKeyResultWithSameTypeMetric() { + void updateKeyResultShouldUpdateKeyResultWithSameTypeMetric() { createdKeyResult = keyResultBusinessService.createKeyResult(createKeyResultMetric(null), jwtToken); createdKeyResult.setTitle(KEY_RESULT_UPDATED); @@ -90,7 +90,7 @@ void updateKeyResult_shouldUpdateKeyResultWithSameTypeMetric() { } @Test - void updateKeyResult_shouldUpdateKeyResultWithSameTypeOrdinal() { + void updateKeyResultShouldUpdateKeyResultWithSameTypeOrdinal() { createdKeyResult = keyResultBusinessService.createKeyResult(createKeyResultOrdinal(null), jwtToken); createdKeyResult.setTitle(KEY_RESULT_UPDATED); @@ -101,7 +101,7 @@ void updateKeyResult_shouldUpdateKeyResultWithSameTypeOrdinal() { } @Test - void updateKeyResult_shouldRecreateKeyResultMetric() { + void updateKeyResultShouldRecreateKeyResultMetric() { KeyResult savedKeyResult = keyResultBusinessService.createKeyResult(createKeyResultOrdinal(null), jwtToken); KeyResult updatedKeyResult = createKeyResultMetric(savedKeyResult.getId()); @@ -111,7 +111,7 @@ void updateKeyResult_shouldRecreateKeyResultMetric() { } @Test - void updateKeyResult_shouldRecreateKeyResultOrdinal() { + void updateKeyResultShouldRecreateKeyResultOrdinal() { KeyResult savedKeyResult = keyResultBusinessService.createKeyResult(createKeyResultMetric(null), jwtToken); KeyResult updatedKeyResult = createKeyResultOrdinal(savedKeyResult.getId()); @@ -121,7 +121,7 @@ void updateKeyResult_shouldRecreateKeyResultOrdinal() { } @Test - void updateKeyResult_shouldUpdateKeyResultWithDifferentTypeAndCheckInMetric() { + void updateKeyResultShouldUpdateKeyResultWithDifferentTypeAndCheckInMetric() { KeyResult savedKeyResult = keyResultBusinessService.createKeyResult(createKeyResultOrdinal(null), jwtToken); checkInBusinessService.createCheckIn(createCheckInOrdinal(savedKeyResult), jwtToken); @@ -133,7 +133,7 @@ void updateKeyResult_shouldUpdateKeyResultWithDifferentTypeAndCheckInMetric() { } @Test - void updateKeyResult_shouldUpdateKeyResultWithDifferentTypeAndCheckInOrdinal() { + void updateKeyResultShouldUpdateKeyResultWithDifferentTypeAndCheckInOrdinal() { KeyResult savedKeyResult = keyResultBusinessService.createKeyResult(createKeyResultMetric(null), jwtToken); checkInBusinessService.createCheckIn(createCheckInMetric(savedKeyResult), jwtToken); diff --git a/backend/src/test/java/ch/puzzle/okr/service/business/OverviewBusinessServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/business/OverviewBusinessServiceTest.java index 59595d0ea1..3c7023f95e 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/business/OverviewBusinessServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/business/OverviewBusinessServiceTest.java @@ -9,9 +9,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.stubbing.OngoingStubbing; import org.springframework.http.HttpStatus; import org.springframework.web.server.ResponseStatusException; @@ -42,21 +40,21 @@ private static Overview createOverview() { @Test void getOverviewByQuarterIdAndTeamIds_ShouldReturnListOfOverviews() { - when(overviewPersistenceService.getOverviewByQuarterIdAndTeamIds(quarterId, teamIds)) + when(overviewPersistenceService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds)) .thenReturn(List.of(createOverview())); - List overviews = overviewBusinessService.getOverviewByQuarterIdAndTeamIds(quarterId, teamIds); + List overviews = overviewBusinessService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds); assertEquals(1, overviews.size()); verify(quarterBusinessService, never()).getCurrentQuarter(); - verify(overviewPersistenceService, never()).getOverviewByQuarterId(quarterId); - verify(overviewValidationService, times(1)).validateOnGet(quarterId, teamIds); - verify(overviewPersistenceService, times(1)).getOverviewByQuarterIdAndTeamIds(quarterId, teamIds); + verify(overviewPersistenceService, never()).getOverviewByQuarterId(QUARTER_ID); + verify(overviewValidationService, times(1)).validateOnGet(QUARTER_ID, teamIds); + verify(overviewPersistenceService, times(1)).getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds); } @Test void getOverviewByQuarterIdAndTeamIds_ShouldReturnListOfOverviewsWhenQuarterIsNull() { - when(overviewPersistenceService.getOverviewByQuarterIdAndTeamIds(quarterId, teamIds)) + when(overviewPersistenceService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds)) .thenReturn(List.of(createOverview())); when(quarterBusinessService.getCurrentQuarter()) .thenReturn(Quarter.Builder.builder().withId(1L).withLabel("GJ 22/23-Q2").build()); @@ -65,51 +63,51 @@ void getOverviewByQuarterIdAndTeamIds_ShouldReturnListOfOverviewsWhenQuarterIsNu assertEquals(1, overviews.size()); verify(quarterBusinessService, times(1)).getCurrentQuarter(); - verify(overviewPersistenceService, never()).getOverviewByQuarterId(quarterId); - verify(overviewValidationService, times(1)).validateOnGet(quarterId, teamIds); - verify(overviewPersistenceService, times(1)).getOverviewByQuarterIdAndTeamIds(quarterId, teamIds); + verify(overviewPersistenceService, never()).getOverviewByQuarterId(QUARTER_ID); + verify(overviewValidationService, times(1)).validateOnGet(QUARTER_ID, teamIds); + verify(overviewPersistenceService, times(1)).getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds); } @Test void getOverviewByQuarterIdAndTeamIds_ShouldReturnListOfOverviewsWhenTeamIdsAreNull() { - when(overviewPersistenceService.getOverviewByQuarterId(quarterId)).thenReturn(List.of(createOverview())); + when(overviewPersistenceService.getOverviewByQuarterId(QUARTER_ID)).thenReturn(List.of(createOverview())); - List overviews = overviewBusinessService.getOverviewByQuarterIdAndTeamIds(quarterId, null); + List overviews = overviewBusinessService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, null); assertEquals(1, overviews.size()); verify(quarterBusinessService, never()).getCurrentQuarter(); - verify(overviewValidationService, times(1)).validateQuarter(quarterId); - verify(overviewPersistenceService, times(1)).getOverviewByQuarterId(quarterId); - verify(overviewValidationService, never()).validateOnGet(quarterId, teamIds); + verify(overviewValidationService, times(1)).validateQuarter(QUARTER_ID); + verify(overviewPersistenceService, times(1)).getOverviewByQuarterId(QUARTER_ID); + verify(overviewValidationService, never()).validateOnGet(QUARTER_ID, teamIds); verify(overviewPersistenceService, never()).getOverviewByQuarterIdAndTeamIds(anyLong(), anyList()); } @Test void getOverviewByQuarterIdAndTeamIds_ShouldReturnExceptionWhenQuarterIdIsNonExistent() { doThrow(new ResponseStatusException(HttpStatus.NOT_FOUND)).when(overviewValidationService) - .validateQuarter(quarterId); + .validateQuarter(QUARTER_ID); assertThrows(ResponseStatusException.class, () -> { - overviewBusinessService.getOverviewByQuarterIdAndTeamIds(quarterId, null); + overviewBusinessService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, null); }); verify(quarterBusinessService, never()).getCurrentQuarter(); - verify(overviewValidationService, times(1)).validateQuarter(quarterId); - verify(overviewPersistenceService, never()).getOverviewByQuarterId(quarterId); - verify(overviewValidationService, never()).validateOnGet(quarterId, teamIds); + verify(overviewValidationService, times(1)).validateQuarter(QUARTER_ID); + verify(overviewPersistenceService, never()).getOverviewByQuarterId(QUARTER_ID); + verify(overviewValidationService, never()).validateOnGet(QUARTER_ID, teamIds); verify(overviewPersistenceService, never()).getOverviewByQuarterIdAndTeamIds(anyLong(), anyList()); } @Test void getOverviewByQuarterIdAndTeamIds_ShouldReturnExceptionWhenTeamIdIsNonExistent() { doThrow(new ResponseStatusException(HttpStatus.NOT_FOUND)).when(overviewValidationService) - .validateOnGet(quarterId, teamIds); + .validateOnGet(QUARTER_ID, teamIds); assertThrows(ResponseStatusException.class, () -> { - overviewBusinessService.getOverviewByQuarterIdAndTeamIds(quarterId, teamIds); + overviewBusinessService.getOverviewByQuarterIdAndTeamIds(QUARTER_ID, teamIds); }); verify(quarterBusinessService, never()).getCurrentQuarter(); - verify(overviewValidationService, never()).validateQuarter(quarterId); - verify(overviewValidationService, times(1)).validateOnGet(quarterId, teamIds); + verify(overviewValidationService, never()).validateQuarter(QUARTER_ID); + verify(overviewValidationService, times(1)).validateOnGet(QUARTER_ID, teamIds); verify(overviewPersistenceService, never()).getOverviewByQuarterIdAndTeamIds(anyLong(), anyList()); } } diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentPersistenceServiceIT.java index 1cb8aea391..90295bfee7 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/AlignmentPersistenceServiceIT.java @@ -17,7 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; @SpringIntegrationTest -public class AlignmentPersistenceServiceIT { +class AlignmentPersistenceServiceIT { Alignment createdAlignment; @Autowired private AlignmentPersistenceService alignmentPersistenceService; @@ -49,7 +49,7 @@ void tearDown() { } @Test - void save_ShouldSaveNewObjectiveAlignment() { + void saveAlignmentShouldSaveNewObjectiveAlignment() { Alignment alignment = createObjectiveAlignment(null); createdAlignment = alignmentPersistenceService.save(alignment); @@ -60,7 +60,7 @@ void save_ShouldSaveNewObjectiveAlignment() { } @Test - void save_ShouldSaveNewKeyResultAlignment() { + void saveAlignmentShouldSaveNewKeyResultAlignment() { Alignment alignment = createKeyResultAlignment(null); createdAlignment = alignmentPersistenceService.save(alignment); @@ -71,7 +71,7 @@ void save_ShouldSaveNewKeyResultAlignment() { } @Test - void findByAlignedObjectiveId_shouldReturnListOfAlignments() { + void findByAlignedObjectiveIdShouldReturnListOfAlignments() { List alignments = alignmentPersistenceService.findByAlignedObjectiveId(4L); assertEquals(2, alignments.size()); @@ -79,7 +79,7 @@ void findByAlignedObjectiveId_shouldReturnListOfAlignments() { } @Test - void findByKeyResultAlignmentId_shouldReturnListOfAlignments() { + void findByKeyResultAlignmentIdShouldReturnListOfAlignments() { List alignments = alignmentPersistenceService.findByKeyResultAlignmentId(8L); assertEquals(1, alignments.size()); @@ -87,7 +87,7 @@ void findByKeyResultAlignmentId_shouldReturnListOfAlignments() { } @Test - void findByObjectiveAlignmentId_shouldReturnListOfAlignments() { + void findByObjectiveAlignmentIdShouldReturnListOfAlignments() { List alignments = alignmentPersistenceService.findByObjectiveAlignmentId(3L); assertEquals(1, alignments.size()); 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 01ecc2c56b..b15c869eb8 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 @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.*; @SpringIntegrationTest -public class CheckInPersistenceServiceIT { +class CheckInPersistenceServiceIT { CheckIn createdCheckIn; @Autowired private CheckInPersistenceService checkInPersistenceService; @@ -48,7 +48,7 @@ void tearDown() { } @Test - void saveCheckIn_ShouldSaveNewCheckIn() { + void saveCheckInShouldSaveNewCheckIn() { CheckIn checkIn = createCheckIn(null); createdCheckIn = checkInPersistenceService.save(checkIn); @@ -63,7 +63,7 @@ void saveCheckIn_ShouldSaveNewCheckIn() { } @Test - void updateKeyResult_ShouldUpdateKeyResult() { + void updateKeyResultShouldUpdateKeyResult() { CheckIn checkIn = createCheckIn(null); createdCheckIn = checkInPersistenceService.save(checkIn); createdCheckIn.setChangeInfo("Updated CheckIn"); @@ -75,14 +75,14 @@ void updateKeyResult_ShouldUpdateKeyResult() { } @Test - void getAllCheckIn_ShouldReturnListOfAllCheckIns() { + void getAllCheckInShouldReturnListOfAllCheckIns() { List checkIns = checkInPersistenceService.findAll(); assertEquals(19, checkIns.size()); } @Test - void getCheckInById_ShouldReturnCheckInProperly() { + void getCheckInByIdShouldReturnCheckInProperly() { CheckIn checkIn = checkInPersistenceService.findById(20L); assertEquals(20L, checkIn.getId()); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/CompletedPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/CompletedPersistenceServiceIT.java index f28e617d07..2c0e237123 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/CompletedPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/CompletedPersistenceServiceIT.java @@ -11,21 +11,19 @@ import static org.junit.jupiter.api.Assertions.*; @SpringIntegrationTest -public class CompletedPersistenceServiceIT { +class CompletedPersistenceServiceIT { @Autowired private CompletedPersistenceService completedPersistenceService; - Completed successfulCompleted = Completed.Builder.builder().withId(1L) - .withObjective(Objective.Builder.builder().withId(3L).withTitle("Gute Lernende").build()) - .withComment("Wir haben es gut geschafft").build(); - - Completed createCompleted = Completed.Builder.builder() - .withObjective(Objective.Builder.builder().withId(3L).withTitle("Gute Lernende").build()) - .withComment("Wir haben es gut geschafft").build(); + private static Completed createCompleted(Long id) { + return Completed.Builder.builder().withId(id) + .withObjective(Objective.Builder.builder().withId(3L).withTitle("Gute Lernende").build()) + .withComment("Wir haben es gut geschafft").build(); + } @Test - void saveCompleted_ShouldSaveCompleted() { - Completed createdCompleted = completedPersistenceService.save(createCompleted); + void saveCompletedShouldSaveCompleted() { + Completed createdCompleted = completedPersistenceService.save(createCompleted(null)); assertNotNull(createdCompleted.getId()); assertEquals(createdCompleted.getComment(), createdCompleted.getComment()); @@ -33,17 +31,17 @@ void saveCompleted_ShouldSaveCompleted() { } @Test - void deleteCompleted_ShouldGetCompletedByObjectiveId() { - Completed savedCompleted = completedPersistenceService.getCompletedByObjectiveId(10L); + void deleteCompletedShouldGetCompletedByObjectiveId() { + Completed savedCompleted = completedPersistenceService.getCompletedByObjectiveId(6L); assertNotNull(savedCompleted.getId()); - assertEquals(savedCompleted.getComment(), "Schade"); - assertEquals(savedCompleted.getObjective().getTitle(), - "should not appear on staging, no sea takimata sanctus est Lorem ipsum dolor sit amet."); + assertEquals("War leider nicht moeglich", savedCompleted.getComment()); + assertEquals("Als BBT wollen wir den Arbeitsalltag der Members von Puzzle ITC erleichtern.", + savedCompleted.getObjective().getTitle()); } @Test - void deleteCompletedId_ShouldDeleteExistingCompletedByObjectiveId() { + void deleteCompletedIdShouldDeleteExistingCompletedByObjectiveId() { completedPersistenceService.deleteById(3L); @@ -54,12 +52,13 @@ void deleteCompletedId_ShouldDeleteExistingCompletedByObjectiveId() { } @Test - void deleteCompleted_ShouldThrowExceptionWhenCompletedNotFound() { - Completed newCompleted = completedPersistenceService.save(successfulCompleted); + void deleteCompletedShouldThrowExceptionWhenCompletedNotFound() { + Completed newCompleted = completedPersistenceService.save(createCompleted(33L)); completedPersistenceService.deleteById(newCompleted.getId()); + Long completedId = newCompleted.getId(); ResponseStatusException exception = assertThrows(ResponseStatusException.class, - () -> completedPersistenceService.findById(newCompleted.getId())); + () -> completedPersistenceService.findById(completedId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals(String.format("Completed with id %d not found", newCompleted.getId()), exception.getReason()); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/KeyResultPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/KeyResultPersistenceServiceIT.java index ac7a407b3b..475a08ddca 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/KeyResultPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/KeyResultPersistenceServiceIT.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.*; @SpringIntegrationTest -public class KeyResultPersistenceServiceIT { +class KeyResultPersistenceServiceIT { KeyResult createdKeyResult; @Autowired private KeyResultPersistenceService keyResultPersistenceService; @@ -60,7 +60,7 @@ void tearDown() { } @Test - void saveKeyResult_ShouldSaveNewKeyResult() { + void saveKeyResultShouldSaveNewKeyResult() { KeyResult keyResult = createKeyResultMetric(null); createdKeyResult = keyResultPersistenceService.save(keyResult); @@ -74,7 +74,7 @@ void saveKeyResult_ShouldSaveNewKeyResult() { } @Test - void getKeyResultById_ShouldReturnKeyResultProperly() { + void getKeyResultByIdShouldReturnKeyResultProperly() { KeyResult keyResult = keyResultPersistenceService.findById(3L); assertEquals(3L, keyResult.getId()); @@ -82,7 +82,7 @@ void getKeyResultById_ShouldReturnKeyResultProperly() { } @Test - void getKeyResultById_ShouldThrowExceptionWhenKeyResultNotFound() { + void getKeyResultByIdShouldThrowExceptionWhenKeyResultNotFound() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> keyResultPersistenceService.findById(321L)); @@ -91,7 +91,7 @@ void getKeyResultById_ShouldThrowExceptionWhenKeyResultNotFound() { } @Test - void getKeyResultById_ShouldThrowExceptionWhenKeyResultIdIsNull() { + void getKeyResultByIdShouldThrowExceptionWhenKeyResultIdIsNull() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> keyResultPersistenceService.findById(null)); @@ -100,7 +100,7 @@ void getKeyResultById_ShouldThrowExceptionWhenKeyResultIdIsNull() { } @Test - void recreateEntity_ShouldUpdateKeyResultNoTypeChange() { + void recreateEntityShouldUpdateKeyResultNoTypeChange() { KeyResult keyResult = createKeyResultOrdinal(null); createdKeyResult = keyResultPersistenceService.save(keyResult); createdKeyResult.setTitle(KEY_RESULT_UPDATED); @@ -113,10 +113,10 @@ void recreateEntity_ShouldUpdateKeyResultNoTypeChange() { assertEquals(createdKeyResult.getOwner().getId(), recreatedKeyResult.getOwner().getId()); assertEquals(createdKeyResult.getObjective().getId(), recreatedKeyResult.getObjective().getId()); + Long keyResultId = createdKeyResult.getId(); // Should delete the old KeyResult - ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> { - keyResultPersistenceService.findById(createdKeyResult.getId()); - }); + ResponseStatusException exception = assertThrows(ResponseStatusException.class, + () -> keyResultPersistenceService.findById(keyResultId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals("KeyResult with id " + createdKeyResult.getId() + " not found", exception.getReason()); @@ -125,7 +125,7 @@ void recreateEntity_ShouldUpdateKeyResultNoTypeChange() { } @Test - void recreateEntity_ShouldUpdateKeyResultWithTypeChange() { + void recreateEntityShouldUpdateKeyResultWithTypeChange() { KeyResult keyResult = createKeyResultMetric(null); createdKeyResult = keyResultPersistenceService.save(keyResult); @@ -143,10 +143,10 @@ void recreateEntity_ShouldUpdateKeyResultWithTypeChange() { assertEquals(KEY_RESULT_UPDATED, recreatedKeyResult.getTitle()); assertEquals(createdKeyResult.getOwner().getId(), recreatedKeyResult.getOwner().getId()); + Long keyResultId = createdKeyResult.getId(); // Should delete the old KeyResult - ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> { - keyResultPersistenceService.findById(createdKeyResult.getId()); - }); + ResponseStatusException exception = assertThrows(ResponseStatusException.class, + () -> keyResultPersistenceService.findById(keyResultId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals("KeyResult with id " + createdKeyResult.getId() + " not found", exception.getReason()); @@ -155,7 +155,7 @@ void recreateEntity_ShouldUpdateKeyResultWithTypeChange() { } @Test - void updateEntity_ShouldUpdateKeyResult() { + void updateEntityShouldUpdateKeyResult() { KeyResult keyResult = createKeyResultOrdinal(null); createdKeyResult = keyResultPersistenceService.save(keyResult); createdKeyResult.setTitle(KEY_RESULT_UPDATED); @@ -172,7 +172,7 @@ void updateEntity_ShouldUpdateKeyResult() { } @Test - void getKeyResultsByObjective_ShouldReturnListOfKeyResults() { + void getKeyResultsByObjectiveShouldReturnListOfKeyResults() { List keyResultsByObjective = keyResultPersistenceService .getKeyResultsByObjective(Objective.Builder.builder().withId(3L).build()); @@ -180,25 +180,27 @@ void getKeyResultsByObjective_ShouldReturnListOfKeyResults() { } @Test - void deleteKeyResultById_ShouldDeleteExistingKeyResult() { + void deleteKeyResultByIdShouldDeleteExistingKeyResult() { KeyResult keyResult = createKeyResultMetric(null); createdKeyResult = keyResultPersistenceService.save(keyResult); keyResultPersistenceService.deleteById(createdKeyResult.getId()); + Long keyResultId = createdKeyResult.getId(); ResponseStatusException exception = assertThrows(ResponseStatusException.class, - () -> keyResultPersistenceService.findById(createdKeyResult.getId())); + () -> keyResultPersistenceService.findById(keyResultId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals(String.format("KeyResult with id %d not found", createdKeyResult.getId()), exception.getReason()); } @Test - void deleteKeyResult_ShouldThrowExceptionWhenKeyResultNotFound() { + void deleteKeyResultShouldThrowExceptionWhenKeyResultNotFound() { KeyResult keyResult = createKeyResultMetric(35234L); KeyResult newKeyResult = keyResultPersistenceService.save(keyResult); keyResultPersistenceService.deleteById(newKeyResult.getId()); + Long keyResultId = newKeyResult.getId(); ResponseStatusException exception = assertThrows(ResponseStatusException.class, - () -> keyResultPersistenceService.findById(newKeyResult.getId())); + () -> keyResultPersistenceService.findById(keyResultId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals(String.format("KeyResult with id %d not found", newKeyResult.getId()), exception.getReason()); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/ObjectivePersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/ObjectivePersistenceServiceIT.java index 1a84f307ff..b8f20f57b2 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/ObjectivePersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/ObjectivePersistenceServiceIT.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.*; @SpringIntegrationTest -public class ObjectivePersistenceServiceIT { +class ObjectivePersistenceServiceIT { Objective createdObjective; @Autowired private ObjectivePersistenceService objectivePersistenceService; @@ -47,14 +47,14 @@ void tearDown() { } @Test - void findAll_ShouldReturnListOfObjectives() { + void findAllShouldReturnListOfObjectives() { List objectives = objectivePersistenceService.findAll(); assertEquals(7, objectives.size()); } @Test - void findById_ShouldReturnObjectiveProperly() { + void findByIdShouldReturnObjectiveProperly() { Objective objective = objectivePersistenceService.findById(5L); assertEquals(5L, objective.getId()); @@ -62,7 +62,7 @@ void findById_ShouldReturnObjectiveProperly() { } @Test - void findById_ShouldThrowExceptionWhenObjectiveNotFound() { + void findByIdShouldThrowExceptionWhenObjectiveNotFound() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> objectivePersistenceService.findById(321L)); @@ -71,7 +71,7 @@ void findById_ShouldThrowExceptionWhenObjectiveNotFound() { } @Test - void findById_ShouldThrowExceptionWhenObjectiveIdIsNull() { + void findByIdShouldThrowExceptionWhenObjectiveIdIsNull() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> objectivePersistenceService.findById(null)); @@ -80,7 +80,7 @@ void findById_ShouldThrowExceptionWhenObjectiveIdIsNull() { } @Test - void saveObjective_shouldSaveNewObjective() { + void saveObjectiveShouldSaveNewObjective() { Objective objective = createObjective(null); createdObjective = objectivePersistenceService.save(objective); @@ -92,7 +92,7 @@ void saveObjective_shouldSaveNewObjective() { } @Test - void updateObjective_shouldUpdateObjective() { + void updateObjectiveShouldUpdateObjective() { Objective objective = createObjective(null); createdObjective = objectivePersistenceService.save(objective); createdObjective.setState(State.ONGOING); @@ -104,42 +104,45 @@ void updateObjective_shouldUpdateObjective() { } @Test - void deleteObjective_ShouldThrowExceptionWhenKeyResultNotFound() { + void deleteObjectiveShouldThrowExceptionWhenKeyResultNotFound() { Objective objective = createObjective(321L); createdObjective = objectivePersistenceService.save(objective); objectivePersistenceService.deleteById(createdObjective.getId()); + Long objectiveId = createdObjective.getId(); ResponseStatusException exception = assertThrows(ResponseStatusException.class, - () -> objectivePersistenceService.findById(createdObjective.getId())); + () -> objectivePersistenceService.findById(objectiveId)); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals(String.format("Objective with id %d not found", createdObjective.getId()), exception.getReason()); } @Test - void countByTeamAndQuarter_shouldReturnActiveObjectivesOfTeamByQuarter() { + void countByTeamAndQuarterShouldReturnActiveObjectivesOfTeamByQuarter() { Integer count = objectivePersistenceService.countByTeamAndQuarter(teamPersistenceService.findById(5L), quarterPersistenceService.findById(2L)); assertEquals(2, count); } @Test - void countByTeamAndQuarter_shouldThrowErrorIfQuarterDoesNotExist() { + void countByTeamAndQuarterShouldThrowErrorIfQuarterDoesNotExist() { + Team teamId5 = teamPersistenceService.findById(5L); ResponseStatusException exception = assertThrows(ResponseStatusException.class, - () -> objectivePersistenceService.countByTeamAndQuarter(teamPersistenceService.findById(5L), + () -> objectivePersistenceService.countByTeamAndQuarter(teamId5, quarterPersistenceService.findById(12L))); assertEquals(HttpStatus.NOT_FOUND, exception.getStatus()); assertEquals(String.format("Quarter with id %d not found", 12), exception.getReason()); + Quarter quarterId2 = quarterPersistenceService.findById(2L); ResponseStatusException exceptionTeam = assertThrows(ResponseStatusException.class, () -> objectivePersistenceService.countByTeamAndQuarter(teamPersistenceService.findById(500L), - quarterPersistenceService.findById(2L))); + quarterId2)); assertEquals(HttpStatus.NOT_FOUND, exceptionTeam.getStatus()); assertEquals(String.format("Team with id %d not found", 500), exceptionTeam.getReason()); } @Test - void countByTeamAndQuarter_ShouldReturnCountValue() { + void countByTeamAndQuarterShouldReturnCountValue() { Integer count = objectivePersistenceService.countByTeamAndQuarter(Team.Builder.builder().withId(5L).build(), Quarter.Builder.builder().withId(2L).build()); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/OverviewPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/OverviewPersistenceServiceIT.java index 686144bddf..223918f848 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/OverviewPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/OverviewPersistenceServiceIT.java @@ -12,12 +12,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @SpringIntegrationTest -public class OverviewPersistenceServiceIT { +class OverviewPersistenceServiceIT { @Autowired private OverviewPersistenceService overviewPersistenceService; @Test - void getOverviewByQuarterIdAndTeamIds_ShouldReturnOverviews() { + void getOverviewByQuarterIdAndTeamIdsShouldReturnOverviews() { List overviews = overviewPersistenceService.getOverviewByQuarterIdAndTeamIds(2L, List.of(5L, 6L, 8L)); assertEquals(13, overviews.size()); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java index b846e308cf..25671cc7d3 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/QuarterPersistenceServiceIT.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.*; @SpringIntegrationTest -public class QuarterPersistenceServiceIT { +class QuarterPersistenceServiceIT { @Autowired private QuarterPersistenceService quarterPersistenceService; diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/TeamPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/TeamPersistenceServiceIT.java index c195733f74..c7e09c90ba 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/TeamPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/TeamPersistenceServiceIT.java @@ -32,7 +32,7 @@ void tearDown() { } @Test - void getTeamById_ShouldReturnTeam() throws ResponseStatusException { + void getTeamByIdShouldReturnTeam() throws ResponseStatusException { Team team = teamPersistenceService.findById(5L); assertEquals(5L, team.getId()); @@ -40,7 +40,7 @@ void getTeamById_ShouldReturnTeam() throws ResponseStatusException { } @Test - void getTeamById_ShouldThrowExceptionWhenTeamNotFound() { + void getTeamByIdShouldThrowExceptionWhenTeamNotFound() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> teamPersistenceService.findById(321L)); @@ -49,7 +49,7 @@ void getTeamById_ShouldThrowExceptionWhenTeamNotFound() { } @Test - void getTeamById_ShouldThrowExceptionWhenTeamIdIsNull() { + void getTeamByIdShouldThrowExceptionWhenTeamIdIsNull() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> teamPersistenceService.findById(null)); diff --git a/backend/src/test/java/ch/puzzle/okr/service/persistence/UserPersistenceServiceIT.java b/backend/src/test/java/ch/puzzle/okr/service/persistence/UserPersistenceServiceIT.java index efe40525f5..9f4b0461fd 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/persistence/UserPersistenceServiceIT.java +++ b/backend/src/test/java/ch/puzzle/okr/service/persistence/UserPersistenceServiceIT.java @@ -79,7 +79,7 @@ void shouldThrowExceptionWhenFindingOwnerWithNullId() { } @Test - void findUserByUsername_ShouldReturnExistingUser() { + void findUserByUsernameShouldReturnExistingUser() { User returnedUser = userPersistenceService.findUserByUsername(USERNAME_ALICE); assertEquals(11L, returnedUser.getId()); @@ -90,7 +90,7 @@ void findUserByUsername_ShouldReturnExistingUser() { } @Test - void findUserByUsername_ShouldThrowExceptionWhenUserNotFound() { + void findUserByUsernameShouldThrowExceptionWhenUserNotFound() { ResponseStatusException exception = assertThrows(ResponseStatusException.class, () -> userPersistenceService.findUserByUsername("unknown")); @@ -99,7 +99,7 @@ void findUserByUsername_ShouldThrowExceptionWhenUserNotFound() { } @Test - void findUserByUsername_ShouldAddUserToCache() { + void findUserByUsernameShouldAddUserToCache() { userPersistenceService.findUserByUsername(USERNAME_ALICE); User cachedUser = cacheManager.getCache(Constants.USER_CACHE).get(USERNAME_ALICE, User.class); @@ -107,7 +107,7 @@ void findUserByUsername_ShouldAddUserToCache() { } @Test - void getOrCreateUser_ShouldReturnSingleUserWhenUserFound() { + void getOrCreateUserShouldReturnSingleUserWhenUserFound() { User existingUser = User.Builder.builder().withUsername(USERNAME_ALICE).build(); User returnedUser = userPersistenceService.getOrCreateUser(existingUser); @@ -120,7 +120,7 @@ void getOrCreateUser_ShouldReturnSingleUserWhenUserFound() { } @Test - void getOrCreateUser_ShouldReturnSavedUserWhenUserNotFound() { + void getOrCreateUserShouldReturnSavedUserWhenUserNotFound() { User newUser = User.Builder.builder().withId(null).withFirstname("firstname").withLastname("lastname") .withUsername("username").withEmail("lastname@puzzle.ch").build(); @@ -134,7 +134,7 @@ void getOrCreateUser_ShouldReturnSavedUserWhenUserNotFound() { } @Test - void getOrCreateUser_ShouldAddUserToCache() { + void getOrCreateUserShouldAddUserToCache() { User existingUser = User.Builder.builder().withUsername(USERNAME_ALICE).build(); userPersistenceService.getOrCreateUser(existingUser); diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/CheckInValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/CheckInValidationServiceTest.java index 0991e49680..955f3dab6a 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/CheckInValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/CheckInValidationServiceTest.java @@ -36,7 +36,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class CheckInValidationServiceTest { +class CheckInValidationServiceTest { @MockBean CheckInPersistenceService checkInPersistenceService = Mockito.mock(CheckInPersistenceService.class); /* Test data */ diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/OverviewValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/OverviewValidationServiceTest.java index c677246ca8..ee76fc8d05 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/OverviewValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/OverviewValidationServiceTest.java @@ -4,9 +4,8 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.boot.test.mock.mockito.MockBean; + import static ch.puzzle.okr.OverviewTestHelper.*; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.times; @@ -25,23 +24,23 @@ class OverviewValidationServiceTest { @Test void validateOnGet_ShouldCallQuarterValidator() { - validator.validateQuarter(quarterId); - verify(quarterValidationService, times(1)).validateOnGet(quarterId); - verify(quarterValidationService, times(1)).doesEntityExist(quarterId); + validator.validateQuarter(QUARTER_ID); + verify(quarterValidationService, times(1)).validateOnGet(QUARTER_ID); + verify(quarterValidationService, times(1)).doesEntityExist(QUARTER_ID); } @Test void validateOnGet_ShouldCallTeamValidator() { - validator.validateTeam(teamId); - verify(teamValidationService, times(1)).validateOnGet(teamId); - verify(teamValidationService, times(1)).doesEntityExist(teamId); + validator.validateTeam(TEAM_ID); + verify(teamValidationService, times(1)).validateOnGet(TEAM_ID); + verify(teamValidationService, times(1)).doesEntityExist(TEAM_ID); } @Test void validateOnGet_ShouldCallQuarterValidatorAndTeamValidator() { - validator.validateOnGet(quarterId, teamIds); - verify(quarterValidationService, times(1)).validateOnGet(quarterId); - verify(quarterValidationService, times(1)).doesEntityExist(quarterId); + validator.validateOnGet(QUARTER_ID, teamIds); + verify(quarterValidationService, times(1)).validateOnGet(QUARTER_ID); + verify(quarterValidationService, times(1)).doesEntityExist(QUARTER_ID); verify(teamValidationService, times(teamIds.size())).validateOnGet(anyLong()); verify(teamValidationService, times(teamIds.size())).doesEntityExist(anyLong()); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/QuarterValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/QuarterValidationServiceTest.java index 1e64f8d01e..a911eef967 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/QuarterValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/QuarterValidationServiceTest.java @@ -15,7 +15,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class QuarterValidationServiceTest { +class QuarterValidationServiceTest { @MockBean QuarterPersistenceService quarterPersistenceService = Mockito.mock(QuarterPersistenceService.class); diff --git a/frontend/src/app/keyresult-detail/keyresult-detail.component.html b/frontend/src/app/keyresult-detail/keyresult-detail.component.html index d963bb56c6..bd86b73653 100644 --- a/frontend/src/app/keyresult-detail/keyresult-detail.component.html +++ b/frontend/src/app/keyresult-detail/keyresult-detail.component.html @@ -86,8 +86,12 @@

Beschrieb

- - + +
diff --git a/frontend/src/app/keyresult-type/keyresult-type.component.ts b/frontend/src/app/keyresult-type/keyresult-type.component.ts index f6f2c765cb..fc898f6acd 100644 --- a/frontend/src/app/keyresult-type/keyresult-type.component.ts +++ b/frontend/src/app/keyresult-type/keyresult-type.component.ts @@ -78,7 +78,7 @@ export class KeyresultTypeComponent implements OnInit { this.keyResultForm.controls['stretchZone'].clearValidators(); } - switchKeyResultType(type: String) { + switchKeyResultType(type: string) { if (((type == 'metric' && !this.isMetric) || (type == 'ordinal' && this.isMetric)) && this.typeChangeAllowed) { this.isMetric = !this.isMetric; let keyResultType = this.isMetric ? 'metric' : 'ordinal'; diff --git a/frontend/src/app/objective-detail/objective-detail.component.scss b/frontend/src/app/objective-detail/objective-detail.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/objective-detail/objective-detail.component.ts b/frontend/src/app/objective-detail/objective-detail.component.ts index 65816ddcbc..8c14b8066c 100644 --- a/frontend/src/app/objective-detail/objective-detail.component.ts +++ b/frontend/src/app/objective-detail/objective-detail.component.ts @@ -9,7 +9,6 @@ import { KeyResultDialogComponent } from '../shared/dialog/key-result-dialog/key @Component({ selector: 'app-objective-detail', templateUrl: './objective-detail.component.html', - styleUrls: ['./objective-detail.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class ObjectiveDetailComponent { diff --git a/frontend/src/app/objective/objective.component.ts b/frontend/src/app/objective/objective.component.ts index cf61190b4f..ea9c85523a 100644 --- a/frontend/src/app/objective/objective.component.ts +++ b/frontend/src/app/objective/objective.component.ts @@ -12,6 +12,7 @@ import { ConfirmDialogComponent } from '../shared/dialog/confirm-dialog/confirm- import { CompleteDialogComponent } from '../shared/dialog/complete-dialog/complete-dialog.component'; import { Completed } from '../shared/types/model/Completed'; import { KeyResultDialogComponent } from '../shared/dialog/key-result-dialog/key-result-dialog.component'; +import { Objective } from '../shared/types/model/Objective'; @Component({ selector: 'app-objective-column', @@ -98,49 +99,63 @@ export class ObjectiveComponent implements OnInit, AfterViewInit { }); matDialogRef.afterClosed().subscribe((result) => { if (result) { - if (menuEntry.action) { - this.objectiveService.getFullObjective(this.objective.value.id).subscribe((objective) => { - if (menuEntry.action == 'complete') { - objective.state = result.endState as State; - const completed: Completed = { - id: null, - objective: objective, - comment: result.comment, - }; - this.objectiveService.updateObjective(objective).subscribe(() => { - this.objectiveService.createCompleted(completed).subscribe(() => { - this.refreshDataService.markDataRefresh(); - }); - }); - } else if (menuEntry.action == 'release') { - if (result) { - objective.state = 'ONGOING' as State; - this.objectiveService.updateObjective(objective).subscribe(() => { - this.refreshDataService.markDataRefresh(); - }); - } - } - }); - } else { - if (result?.objective) { - this.refreshDataService.markDataRefresh(); - } - } + this.completeReleaseReload(menuEntry, result); } }); } else { - if (menuEntry.action === 'reopen') { - this.objectiveService.getFullObjective(this.objective.value.id).subscribe((objective) => { - objective.state = 'ONGOING' as State; - this.objectiveService.updateObjective(objective).subscribe(() => { - this.objectiveService.deleteCompleted(objective.id).subscribe(() => { - this.refreshDataService.markDataRefresh(); - }); + this.reopenRedirect(menuEntry); + } + } + + completeReleaseReload(menuEntry: MenuEntry, result: { endState: string; comment: string | null; objective: any }) { + if (menuEntry.action) { + this.objectiveService.getFullObjective(this.objective.value.id).subscribe((objective) => { + if (menuEntry.action == 'complete') { + this.completeObjective(objective, result); + } else if (menuEntry.action == 'release') { + this.releaseObjective(objective); + } + }); + } else { + if (result?.objective) { + this.refreshDataService.markDataRefresh(); + } + } + } + + completeObjective(objective: Objective, result: { endState: string; comment: string | null; objective: any }) { + objective.state = result.endState as State; + const completed: Completed = { + id: null, + objective: objective, + comment: result.comment, + }; + this.objectiveService.updateObjective(objective).subscribe(() => { + this.objectiveService.createCompleted(completed).subscribe(() => { + this.refreshDataService.markDataRefresh(); + }); + }); + } + + releaseObjective(objective: Objective) { + objective.state = 'ONGOING' as State; + this.objectiveService.updateObjective(objective).subscribe(() => { + this.refreshDataService.markDataRefresh(); + }); + } + + reopenRedirect(menuEntry: MenuEntry) { + if (menuEntry.action === 'reopen') { + this.objectiveService.getFullObjective(this.objective.value.id).subscribe((objective) => { + objective.state = 'ONGOING' as State; + this.objectiveService.updateObjective(objective).subscribe(() => { + this.objectiveService.deleteCompleted(objective.id).subscribe(() => { + this.refreshDataService.markDataRefresh(); }); }); - } else { - this.router.navigate([menuEntry.route!]); - } + }); + } else { + this.router.navigate([menuEntry.route!]); } } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.scss b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts index 86fc1e4797..e15be6297d 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts @@ -5,7 +5,6 @@ import errorMessages from '../../../../../assets/errors/error-messages.json'; @Component({ selector: 'app-check-in-base-informations', templateUrl: './check-in-base-informations.component.html', - styleUrls: ['./check-in-base-informations.component.scss'], }) export class CheckInBaseInformationsComponent { @Input() diff --git a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.scss b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts index 13a55b0500..040601c6d5 100644 --- a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts +++ b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts @@ -4,7 +4,6 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @Component({ selector: 'app-confirm-dialog', templateUrl: './confirm-dialog.component.html', - styleUrls: ['./confirm-dialog.component.scss'], }) export class ConfirmDialogComponent implements OnInit { dialogTitle: string = ''; diff --git a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.scss b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts index 39e19b7099..e356d0b8dd 100644 --- a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts +++ b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts @@ -6,7 +6,6 @@ import errorMessages from '../../../../assets/errors/error-messages.json'; @Component({ selector: 'app-example-dialog', templateUrl: './example-dialog.component.html', - styleUrls: ['./example-dialog.component.scss'], }) export class ExampleDialogComponent { hobbies = ['fishing', 'football', 'videogames', 'tennis', 'other']; diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts index e5c7540359..299b33d29d 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts @@ -52,7 +52,7 @@ export class ObjectiveFormComponent implements OnInit { onSubmit(event: any): void { const value = this.objectiveForm.getRawValue(); - const state = this.state == null ? event.submitter.getAttribute('submitType') : this.state; + const state = this.data.objective.objectiveId == null ? event.submitter.getAttribute('submitType') : this.state; let objectiveDTO: Objective = { id: this.data.objective.objectiveId, quarterId: value.quarter, diff --git a/frontend/src/app/shared/pipes/unit-label-transformation/unit-label-transformation.pipe.ts b/frontend/src/app/shared/pipes/unit-label-transformation/unit-label-transformation.pipe.ts index 8c26faafbb..6d2e4afbd2 100644 --- a/frontend/src/app/shared/pipes/unit-label-transformation/unit-label-transformation.pipe.ts +++ b/frontend/src/app/shared/pipes/unit-label-transformation/unit-label-transformation.pipe.ts @@ -1,12 +1,11 @@ import { Pipe, PipeTransform } from '@angular/core'; import { Unit } from '../../types/enums/Unit'; -import translation from '../../../../assets/i18n/de.json'; @Pipe({ name: 'unitLabelTransformation', }) export class UnitLabelTransformationPipe implements PipeTransform { - transform(unitLabel: String): String { + transform(unitLabel: string): string { switch (unitLabel) { case Unit.PERCENT: return ''; diff --git a/frontend/src/app/shared/pipes/unit-value-transformation/unit-value-transformation.pipe.ts b/frontend/src/app/shared/pipes/unit-value-transformation/unit-value-transformation.pipe.ts index 8cf6b456c8..ae5cfe9da2 100644 --- a/frontend/src/app/shared/pipes/unit-value-transformation/unit-value-transformation.pipe.ts +++ b/frontend/src/app/shared/pipes/unit-value-transformation/unit-value-transformation.pipe.ts @@ -6,7 +6,7 @@ import { THOUSAND_SEPERATOR } from '../../regexLibrary'; name: 'unitValueTransformation', }) export class UnitValueTransformationPipe implements PipeTransform { - transform(value: number, unit: String): string { + transform(value: number, unit: string): string { /* If user tries to input String, set value to 0 */ if (Number.isNaN(value)) { value = 0; diff --git a/frontend/src/app/shared/types/DTOs/KeyResultDTO.ts b/frontend/src/app/shared/types/DTOs/KeyResultDTO.ts index b39d58b578..ac535fc3fe 100644 --- a/frontend/src/app/shared/types/DTOs/KeyResultDTO.ts +++ b/frontend/src/app/shared/types/DTOs/KeyResultDTO.ts @@ -9,7 +9,7 @@ export interface KeyResultDTO { description: string; owner: User; objective: Objective; - lastCheckIn?: CheckIn | null | undefined; - createdOn?: Date | null | undefined; - modifiedOn?: Date | null | undefined; + lastCheckIn: CheckIn | null | undefined; + createdOn: Date | null | undefined; + modifiedOn: Date | null | undefined; } diff --git a/frontend/src/app/team-filter/team-filter.component.scss b/frontend/src/app/team-filter/team-filter.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/team-filter/team-filter.component.ts b/frontend/src/app/team-filter/team-filter.component.ts index a83ddf4c23..4cd0eadc2f 100644 --- a/frontend/src/app/team-filter/team-filter.component.ts +++ b/frontend/src/app/team-filter/team-filter.component.ts @@ -9,7 +9,6 @@ import { areEqual, getValueFromQuery, optionalReplaceWithNulls } from '../shared @Component({ selector: 'app-team-filter', templateUrl: './team-filter.component.html', - styleUrls: ['./team-filter.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class TeamFilterComponent implements OnInit {