/**
   * 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);
  }
  /**
   * If {@link RangeMetric#changeRange(double)} has not been called; 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_noChangeRange() {
    // Should give ranges: 0, 270, 450, 540, 900
    items.add(ItemDB.lookup("MEDIUM LASER"));
    items.add(ItemDB.lookup("LARGE LASER"));

    Mockito.when(cut.calculate(Matchers.anyDouble())).thenReturn(0.0);
    Mockito.when(cut.calculate(270.0)).thenReturn(1.0);
    Mockito.when(cut.calculate(450.0)).thenReturn(3.0);
    Mockito.when(cut.calculate(540.0)).thenReturn(2.0);
    Mockito.when(cut.calculate(900.0)).thenReturn(1.0);

    assertEquals(3.0, cut.calculate(), 0.0);
  }
  /**
   * 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();
  }