Skip to content

Commit

Permalink
Correctly case name of constant
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Jan 28, 2025
1 parent d95d251 commit 5ab90d3
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private Constants() {
public static final String USER = "User";
public static final String USER_TEAM = "UserTeam";

public static final String BACK_LOG_QUARTER_LABEL = "Backlog";
public static final String BACKLOG_QUARTER_LABEL = "Backlog";
public static final String CHECK_IN_KEY_RESULT_ID_ATTRIBUTE_NAME = "keyResultId";
public static final String KEY_RESULT_TYPE_ATTRIBUTE_NAME = "keyResultType";

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/ch/puzzle/okr/models/Quarter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.models;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
Expand Down Expand Up @@ -61,7 +61,7 @@ public void setEndDate(LocalDate endDate) {
}

public boolean isBacklogQuarter() {
return this.label.equals(BACK_LOG_QUARTER_LABEL) && this.startDate == null && this.endDate == null;
return this.label.equals(BACKLOG_QUARTER_LABEL) && this.startDate == null && this.endDate == null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.service.business;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;

import ch.puzzle.okr.models.Quarter;
import ch.puzzle.okr.multitenancy.TenantConfigProvider;
Expand Down Expand Up @@ -48,7 +48,7 @@ public Quarter getQuarterById(Long quarterId) {

public List<Quarter> getQuarters() {
List<Quarter> mostCurrentQuarterList = quarterPersistenceService.getMostCurrentQuarters();
Quarter backlog = quarterPersistenceService.findByLabel(BACK_LOG_QUARTER_LABEL);
Quarter backlog = quarterPersistenceService.findByLabel(BACKLOG_QUARTER_LABEL);
mostCurrentQuarterList.add(0, backlog);
return mostCurrentQuarterList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void throwExceptionWhenNotDraftInBacklogQuarter(Objective model) {
}

private boolean isInvalidBacklogObjective(Objective model) {
return model.getQuarter().getLabel().equals(BACK_LOG_QUARTER_LABEL) //
return model.getQuarter().getLabel().equals(BACKLOG_QUARTER_LABEL) //
&& model.getQuarter().getStartDate() == null //
&& model.getQuarter().getEndDate() == null //
&& (model.getState() != State.DRAFT);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.service.validation;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;

import ch.puzzle.okr.ErrorKey;
import ch.puzzle.okr.exception.OkrResponseStatusException;
Expand Down Expand Up @@ -31,7 +31,7 @@ public void validateOnUpdate(Long id, Quarter model) {
}

public static void throwExceptionWhenStartEndDateQuarterIsNull(Quarter model) {
if (!model.getLabel().equals(BACK_LOG_QUARTER_LABEL)) {
if (!model.getLabel().equals(BACKLOG_QUARTER_LABEL)) {
if (model.getStartDate() == null) {
throw new OkrResponseStatusException(HttpStatus.BAD_REQUEST,
ErrorKey.ATTRIBUTE_NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.controller;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;
import static ch.puzzle.okr.test.TestConstants.BACK_LOG_QUARTER_ID;
import static org.mockito.ArgumentMatchers.any;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
Expand Down Expand Up @@ -60,7 +60,7 @@ class QuarterControllerIT {
static Quarter backlogQuarter = Quarter.Builder
.builder()
.withId(BACK_LOG_QUARTER_ID)
.withLabel(BACK_LOG_QUARTER_LABEL)
.withLabel(BACKLOG_QUARTER_LABEL)
.withStartDate(null)
.withEndDate(null)
.build();
Expand Down Expand Up @@ -103,7 +103,7 @@ void shouldGetAllQuarters() throws Exception {
.andExpect(jsonPath("$[1].endDate", Is.is(LocalDate.of(2023, 3, 31).toString())))
.andExpect(jsonPath("$[1].isBacklogQuarter", Is.is(false)))
.andExpect(jsonPath("$[2].id", Is.is((int) BACK_LOG_QUARTER_ID)))
.andExpect(jsonPath("$[2].label", Is.is(BACK_LOG_QUARTER_LABEL)))
.andExpect(jsonPath("$[2].label", Is.is(BACKLOG_QUARTER_LABEL)))
.andExpect(jsonPath("$[2].isBacklogQuarter", Is.is(true)));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.service.business;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;
import static ch.puzzle.okr.test.TestConstants.BACK_LOG_QUARTER_ID;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -95,14 +95,14 @@ void shouldGetBacklogQuarter() {
Quarter backlogQuarter = Quarter.Builder
.builder()
.withId(BACK_LOG_QUARTER_ID)
.withLabel(BACK_LOG_QUARTER_LABEL)
.withLabel(BACKLOG_QUARTER_LABEL)
.build();
when(quarterPersistenceService.getMostCurrentQuarters()).thenReturn(quarterList);
when(quarterPersistenceService.findByLabel(BACK_LOG_QUARTER_LABEL)).thenReturn(backlogQuarter);
when(quarterPersistenceService.findByLabel(BACKLOG_QUARTER_LABEL)).thenReturn(backlogQuarter);

quarterList = quarterBusinessService.getQuarters();
assertEquals(3, quarterList.size());
assertEquals(BACK_LOG_QUARTER_LABEL, quarterList.get(0).getLabel());
assertEquals(BACKLOG_QUARTER_LABEL, quarterList.get(0).getLabel());
assertNull(quarterList.get(0).getStartDate());
assertNull(quarterList.get(0).getEndDate());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.service.validation;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;
import static ch.puzzle.okr.test.TestConstants.BACK_LOG_QUARTER_ID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -542,7 +542,7 @@ void shouldThrowExceptionOnValidateOnCreateWhenQuarterIsBacklogAndStateIsNotDraf
Quarter backlogQuarter = Quarter.Builder
.builder()
.withId(BACK_LOG_QUARTER_ID)
.withLabel(BACK_LOG_QUARTER_LABEL)
.withLabel(BACKLOG_QUARTER_LABEL)
.withStartDate(null)
.withEndDate(null)
.build();
Expand Down Expand Up @@ -573,7 +573,7 @@ void shouldThrowExceptionOnValidateOnUpdateWhenQuarterIsBacklogAndStateIsNotDraf
Quarter backlogQuarter = Quarter.Builder
.builder()
.withId(BACK_LOG_QUARTER_ID)
.withLabel(BACK_LOG_QUARTER_LABEL)
.withLabel(BACKLOG_QUARTER_LABEL)
.withStartDate(null)
.withEndDate(null)
.build();
Expand Down Expand Up @@ -606,7 +606,7 @@ void shouldPassOnValidateOnUpdateWhenQuarterIsBacklogAndStateIsDraft() {
Quarter backlogQuarter = Quarter.Builder
.builder()
.withId(BACK_LOG_QUARTER_ID)
.withLabel(BACK_LOG_QUARTER_LABEL)
.withLabel(BACKLOG_QUARTER_LABEL)
.withStartDate(null)
.withEndDate(null)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.puzzle.okr.service.validation;

import static ch.puzzle.okr.Constants.BACK_LOG_QUARTER_LABEL;
import static ch.puzzle.okr.Constants.BACKLOG_QUARTER_LABEL;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
Expand Down Expand Up @@ -31,7 +31,7 @@ class QuarterValidationServiceTest {
void shouldThrowExceptionWhenStartEndDateQuarterIsNullShouldDoNothingWhenQuarterLabelIsBacklog() {
// arrange
Quarter quarter = mock(Quarter.class);
when(quarter.getLabel()).thenReturn(BACK_LOG_QUARTER_LABEL);
when(quarter.getLabel()).thenReturn(BACKLOG_QUARTER_LABEL);

// act
QuarterValidationService.throwExceptionWhenStartEndDateQuarterIsNull(quarter);
Expand Down

0 comments on commit 5ab90d3

Please sign in to comment.