Score { public int minimumScore() { if (surveyType != null & scoreRules.containsKey(surveyType)){ return scoreRules.get(surveyType).get(surveyTypeScale).get("min"); } else { return scoreRules.get("NPS").get(surveyTypeScale).get("min"); } } Score(int score, String surveyType, int surveyTypeScale); boolean isDetractor(); boolean isPassive(); boolean isPromoter(); int maximumScore(); int minimumScore();  }
@Test public void whenScaleCES_itReturnsCorrectMin() throws Exception { Score score = new Score(0, "CES", 0); Score score2 = new Score(0, "CES", 1); Score score3 = new Score(0, "CES", -1); assertThat(score.minimumScore()).isEqualTo(1); assertThat(score2.minimumScore()).isEqualTo(1); assertThat(score3.minimumScore()).isEqualTo(1); }
@Test public void whenScaleCSAT_itReturnsCorrectMin() throws Exception { Score score = new Score(0, "CSAT", 0); Score score2 = new Score(0, "CSAT", 1); Score score3 = new Score(0, "CSAT", -1); assertThat(score.minimumScore()).isEqualTo(1); assertThat(score2.minimumScore()).isEqualTo(1); assertThat(score3.minimumScore()).isEqualTo(1); }
@Test public void whenScaleNPS_itReturnsCorrectMin() throws Exception { Score score = new Score(8, "NPS", 0); Score score2 = new Score(8, "NPS", 1); Score score3 = new Score(8, "NPS", -1); assertThat(score.minimumScore()).isEqualTo(0); assertThat(score2.minimumScore()).isEqualTo(0); assertThat(score3.minimumScore()).isEqualTo(0); }