@Test public void shouldReturnPriceLevelsInTheCorrectOrder() { final PriceLevels cut = new PriceLevels(new Price(5.4), new Price(3.5), new Price(6.9), new Price(-1.6)); assertThat(cut.get(0)).isEqualTo(new Price(-1.6)); assertThat(cut.get(1)).isEqualTo(new Price(3.5)); assertThat(cut.get(2)).isEqualTo(new Price(5.4)); assertThat(cut.get(3)).isEqualTo(new Price(6.9)); }
public Price get(final int index) throws IndexOutOfBoundsException { return priceLevels[index]; }
PriceLevels { public Price get(final int index) throws IndexOutOfBoundsException { return priceLevels[index]; } }
PriceLevels { public Price get(final int index) throws IndexOutOfBoundsException { return priceLevels[index]; } PriceLevels(final Price... priceLevels);  PriceLevels(final List<Price> priceLevels); }
PriceLevels { public Price get(final int index) throws IndexOutOfBoundsException { return priceLevels[index]; } PriceLevels(final Price... priceLevels);  PriceLevels(final List<Price> priceLevels); Optional<Price> nextHigherLevel(final Price price); Optional<Price> nextLowerLevel(final Price price); int count(); Price get(final int index); boolean contains(final Price price); @Override String toString(); }
PriceLevels { public Price get(final int index) throws IndexOutOfBoundsException { return priceLevels[index]; } PriceLevels(final Price... priceLevels);  PriceLevels(final List<Price> priceLevels); Optional<Price> nextHigherLevel(final Price price); Optional<Price> nextLowerLevel(final Price price); int count(); Price get(final int index); boolean contains(final Price price); @Override String toString();  }