@Test public void shouldWeightOk_forTwoBarsPriorMatch(){ BeatLoop barTooWeight = new BeatLoop(); barTooWeight.setId(2); oneBarLoop = new BeatLoop(); oneBarLoop.setId(1); onePriorProgBar.setBeatLoopAlt(oneBarLoop); twoBarsLoop = new BeatLoop(); twoBarsLoop.setId(2); twoPrioProgBar.setBeatLoopAlt(twoBarsLoop); WeightClass result = beatAltThemeWeighter.calculateThemeWeight(barTooWeight, onePriorProgBar, twoPrioProgBar); assertThat(result).isEqualTo(WeightClass.OK); }
public WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior){ WeightClass weightClass = WeightClass.BAD; if(secondBarPrior != null && secondBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(secondBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.OK; } if(oneBarPrior != null && oneBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(oneBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.GOOD; } return weightClass; }
BeatLoopAltThemeWeighter { public WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior){ WeightClass weightClass = WeightClass.BAD; if(secondBarPrior != null && secondBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(secondBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.OK; } if(oneBarPrior != null && oneBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(oneBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.GOOD; } return weightClass; } }
BeatLoopAltThemeWeighter { public WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior){ WeightClass weightClass = WeightClass.BAD; if(secondBarPrior != null && secondBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(secondBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.OK; } if(oneBarPrior != null && oneBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(oneBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.GOOD; } return weightClass; }  }
BeatLoopAltThemeWeighter { public WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior){ WeightClass weightClass = WeightClass.BAD; if(secondBarPrior != null && secondBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(secondBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.OK; } if(oneBarPrior != null && oneBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(oneBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.GOOD; } return weightClass; }  WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior); }
BeatLoopAltThemeWeighter { public WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior){ WeightClass weightClass = WeightClass.BAD; if(secondBarPrior != null && secondBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(secondBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.OK; } if(oneBarPrior != null && oneBarPrior.getBeatLoopAlt() != null && optionToWeight.getId().equals(oneBarPrior.getBeatLoopAlt().getId())){ weightClass = WeightClass.GOOD; } return weightClass; }  WeightClass calculateThemeWeight(BeatLoop optionToWeight, ProgressionUnitBar oneBarPrior, ProgressionUnitBar secondBarPrior);  }