Score { public boolean isPassive() { if (surveyType != null & scoreRules.containsKey(surveyType)){ return score > scoreRules.get(surveyType).get(surveyTypeScale).get("negative_type_max") && score <= scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max"); } else { return score > scoreRules.get("NPS").get(surveyTypeScale).get("negative_type_max") && score <= scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max"); } } Score(int score, String surveyType, int surveyTypeScale); boolean isDetractor(); boolean isPassive(); boolean isPromoter(); int maximumScore(); int minimumScore();  }
@Test public void whenPassiveAndScaleCES_itReturnsTrue() throws Exception { Score score = new Score(4, "CES", 0); Score score2 = new Score(5, "CES", 0); Score score3 = new Score(4, "CES", 1); Score score4 = new Score(5, "CES", 1); assertThat(score.isPassive()).isTrue(); assertThat(score2.isPassive()).isTrue(); assertThat(score3.isPassive()).isTrue(); assertThat(score4.isPassive()).isTrue(); }
@Test public void whenNotPassiveAndScaleCES_itReturnsFalse() throws Exception { Score score = new Score(3, "CES", 0); Score score2 = new Score(6, "CES", 0); Score score3 = new Score(3, "CES", 1); Score score4 = new Score(6, "CES", 1); assertThat(score.isPassive()).isFalse(); assertThat(score2.isPassive()).isFalse(); assertThat(score3.isPassive()).isFalse(); assertThat(score4.isPassive()).isFalse(); }
@Test public void whenPassiveAndScaleCSAT_itReturnsTrue() throws Exception { Score score = new Score(3, "CSAT", 0); Score score2 = new Score(7, "CSAT", 1); Score score3 = new Score(8, "CSAT", 1); assertThat(score.isPassive()).isTrue(); assertThat(score2.isPassive()).isTrue(); assertThat(score3.isPassive()).isTrue(); }
@Test public void whenNotPassiveAndScaleCSAT_itReturnsFalse() throws Exception { Score score = new Score(2, "CSAT", 0); Score score2 = new Score(4, "CSAT", 0); Score score3 = new Score(5, "CSAT", 1); Score score4 = new Score(9, "CSAT", 1); assertThat(score.isPassive()).isFalse(); assertThat(score2.isPassive()).isFalse(); assertThat(score3.isPassive()).isFalse(); assertThat(score4.isPassive()).isFalse(); }
@Test public void whenPassiveAndScaleNPS_itReturnsTrue() throws Exception { Score score = new Score(7, "NPS", 0); Score score2 = new Score(8, "NPS", 0); Score score3 = new Score(7, "NPS", 1); Score score4 = new Score(8, "NPS", 1); assertThat(score.isPassive()).isTrue(); assertThat(score2.isPassive()).isTrue(); assertThat(score3.isPassive()).isTrue(); assertThat(score4.isPassive()).isTrue(); }
@Test public void whenNotPassiveAndScaleNPS_itReturnsFalse() throws Exception { Score score = new Score(6, "NPS", 0); Score score2 = new Score(9, "NPS", 0); Score score3 = new Score(6, "NPS", 1); Score score4 = new Score(9, "NPS", 1); assertThat(score.isPassive()).isFalse(); assertThat(score2.isPassive()).isFalse(); assertThat(score3.isPassive()).isFalse(); assertThat(score4.isPassive()).isFalse(); }