@Test public void shouldClassifyAsGood(){ EqWeightResponse eqWeightResponse = new EqWeightResponse(); eqWeightResponse.setEqbands(generateBands()); WeightClass weightClass = WeightClassificationUtils.weightMidEqRegister(eqWeightResponse); assertThat(weightClass).isEqualTo(WeightClass.GOOD); }
public static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse) { int badCount = 0; int okCount = 0; int goodCount = 0; for (Ratings rating : eqWeightResponse.getEqbands()) { if (isMidEqRegister(rating)) { if (rating.getRating().toLowerCase().contains("0")) { badCount++; } if (rating.getRating() .toLowerCase().contains("1")) { okCount++; } if (rating.getRating().toLowerCase().contains("2")) { goodCount++; } } } if (badCount >= okCount && badCount >= goodCount) { return WeightClass.BAD; } if (okCount >= goodCount && okCount >= badCount) { return WeightClass.OK; } return WeightClass.GOOD; }
WeightClassificationUtils { public static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse) { int badCount = 0; int okCount = 0; int goodCount = 0; for (Ratings rating : eqWeightResponse.getEqbands()) { if (isMidEqRegister(rating)) { if (rating.getRating().toLowerCase().contains("0")) { badCount++; } if (rating.getRating() .toLowerCase().contains("1")) { okCount++; } if (rating.getRating().toLowerCase().contains("2")) { goodCount++; } } } if (badCount >= okCount && badCount >= goodCount) { return WeightClass.BAD; } if (okCount >= goodCount && okCount >= badCount) { return WeightClass.OK; } return WeightClass.GOOD; } }
WeightClassificationUtils { public static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse) { int badCount = 0; int okCount = 0; int goodCount = 0; for (Ratings rating : eqWeightResponse.getEqbands()) { if (isMidEqRegister(rating)) { if (rating.getRating().toLowerCase().contains("0")) { badCount++; } if (rating.getRating() .toLowerCase().contains("1")) { okCount++; } if (rating.getRating().toLowerCase().contains("2")) { goodCount++; } } } if (badCount >= okCount && badCount >= goodCount) { return WeightClass.BAD; } if (okCount >= goodCount && okCount >= badCount) { return WeightClass.OK; } return WeightClass.GOOD; }  }
WeightClassificationUtils { public static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse) { int badCount = 0; int okCount = 0; int goodCount = 0; for (Ratings rating : eqWeightResponse.getEqbands()) { if (isMidEqRegister(rating)) { if (rating.getRating().toLowerCase().contains("0")) { badCount++; } if (rating.getRating() .toLowerCase().contains("1")) { okCount++; } if (rating.getRating().toLowerCase().contains("2")) { goodCount++; } } } if (badCount >= okCount && badCount >= goodCount) { return WeightClass.BAD; } if (okCount >= goodCount && okCount >= badCount) { return WeightClass.OK; } return WeightClass.GOOD; }  static WeightClass verticalWeightToClass(String verticalClass); static WeightClass eqResponseToWeightClass(EqWeightResponse eqWeightResponse); static WeightClass weightLowEqRegister(EqWeightResponse eqWeightResponse); static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse); static WeightClass weightHiEqRegister(EqWeightResponse eqWeightResponse); static boolean isLowEqRegister(Ratings rating); static boolean isMidEqRegister(Ratings rating); static boolean isHiEqRegister(Ratings rating); }
WeightClassificationUtils { public static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse) { int badCount = 0; int okCount = 0; int goodCount = 0; for (Ratings rating : eqWeightResponse.getEqbands()) { if (isMidEqRegister(rating)) { if (rating.getRating().toLowerCase().contains("0")) { badCount++; } if (rating.getRating() .toLowerCase().contains("1")) { okCount++; } if (rating.getRating().toLowerCase().contains("2")) { goodCount++; } } } if (badCount >= okCount && badCount >= goodCount) { return WeightClass.BAD; } if (okCount >= goodCount && okCount >= badCount) { return WeightClass.OK; } return WeightClass.GOOD; }  static WeightClass verticalWeightToClass(String verticalClass); static WeightClass eqResponseToWeightClass(EqWeightResponse eqWeightResponse); static WeightClass weightLowEqRegister(EqWeightResponse eqWeightResponse); static WeightClass weightMidEqRegister(EqWeightResponse eqWeightResponse); static WeightClass weightHiEqRegister(EqWeightResponse eqWeightResponse); static boolean isLowEqRegister(Ratings rating); static boolean isMidEqRegister(Ratings rating); static boolean isHiEqRegister(Ratings rating);  }