Score { public boolean isPromoter() { if (surveyType != null & scoreRules.containsKey(surveyType)){ return score > scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max") && score <= scoreRules.get(surveyType).get(surveyTypeScale).get("max") ; } else { return score > scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max") && score <= scoreRules.get("NPS").get(surveyTypeScale).get("max") ; } } Score(int score, String surveyType, int surveyTypeScale); boolean isDetractor(); boolean isPassive(); boolean isPromoter(); int maximumScore(); int minimumScore();  }
@Test public void whenPromoterAndScaleCES_itReturnsTrue() throws Exception { Score score = new Score(6, "CES", 0); Score score2 = new Score(7, "CES", 0); Score score3 = new Score(6, "CES", 1); Score score4 = new Score(7, "CES", 1); assertThat(score.isPromoter()).isTrue(); assertThat(score2.isPromoter()).isTrue(); assertThat(score3.isPromoter()).isTrue(); assertThat(score4.isPromoter()).isTrue(); }
@Test public void whenNotPromoterAndScaleCES_itReturnsTrue() throws Exception { Score score = new Score(5, "CES", 0); Score score2 = new Score(8, "CES", 0); Score score3 = new Score(5, "CES", 1); Score score4 = new Score(8, "CES", 1); assertThat(score.isPromoter()).isFalse(); assertThat(score2.isPromoter()).isFalse(); assertThat(score3.isPromoter()).isFalse(); assertThat(score4.isPromoter()).isFalse(); }
@Test public void whenPromoterAndScaleCSAT_itReturnsTrue() throws Exception { Score score = new Score(4, "CSAT", 0); Score score2 = new Score(5, "CSAT", 0); Score score3 = new Score(9, "CSAT", 1); Score score4 = new Score(10, "CSAT", 1); assertThat(score.isPromoter()).isTrue(); assertThat(score2.isPromoter()).isTrue(); assertThat(score3.isPromoter()).isTrue(); assertThat(score4.isPromoter()).isTrue(); }
@Test public void whenNotPromoterAndScaleCSAT_itReturnsTrue() throws Exception { Score score = new Score(3, "CSAT", 0); Score score2 = new Score(6, "CSAT", 0); Score score3 = new Score(0, "CSAT", 1); Score score4 = new Score(8, "CSAT", 1); assertThat(score.isPromoter()).isFalse(); assertThat(score2.isPromoter()).isFalse(); assertThat(score3.isPromoter()).isFalse(); assertThat(score4.isPromoter()).isFalse(); }
@Test public void whenPromoterAndScaleNPS_itReturnsTrue() throws Exception { Score score = new Score(9, "NPS", 0); Score score2 = new Score(10, "NPS", 0); Score score3 = new Score(9, "NPS", 1); Score score4 = new Score(10, "NPS", 1); assertThat(score.isPromoter()).isTrue(); assertThat(score2.isPromoter()).isTrue(); assertThat(score3.isPromoter()).isTrue(); assertThat(score4.isPromoter()).isTrue(); }
@Test public void whenNotPromoterAndScaleNPS_itReturnsTrue() throws Exception { Score score = new Score(8, "NPS", 0); Score score2 = new Score(11, "NPS", 0); Score score3 = new Score(8, "NPS", 1); Score score4 = new Score(11, "NPS", 1); assertThat(score.isPromoter()).isFalse(); assertThat(score2.isPromoter()).isFalse(); assertThat(score3.isPromoter()).isFalse(); assertThat(score4.isPromoter()).isFalse(); }