/** * If {@link RangeMetric#changeRange(double)} was last called with a negative or zero argument; a * call to {@link RangeMetric#calculate()} should return the maximum value of {@link * RangeMetric#calculate(double)} for all the ranges returned by {@link * WeaponRanges#getRanges(lisong_mechlab.model.loadout.LoadoutBase)}. */ @Test public final void testCalculate_negativeChangeRange() { cut.changeRange(10.0); cut.changeRange(-1.0); testCalculate_noChangeRange(); }
/** * A call to {@link RangeMetric#calculate()} after {@link RangeMetric#changeRange(double)} has * been called with a positive, non-negative argument should return the value of {@link * RangeMetric#calculate(double)} called with the same argument as {@link * RangeMetric#changeRange(double)} was called. */ @Test public final void testCalculate_changeRange() { double range = 20.0; Mockito.when(cut.calculate(Matchers.anyDouble())).thenReturn(0.0); Mockito.when(cut.calculate(range)).thenReturn(1.0); cut.changeRange(range); assertEquals(1.0, cut.calculate(), 0.0); }