@Test public void roundsVolumeDownToNextStepSize() { assertThat(cut.round(new Volume(32, BASE), new Volume(10, BASE))).isEqualTo(new Volume(30, BASE)); assertThat(cut.round(new Volume(37, BASE), new Volume(10, BASE))).isEqualTo(new Volume(30, BASE)); assertThat(cut.round(new Volume(2, BASE), new Volume(10, BASE))).isEqualTo(new Volume(0, BASE)); assertThat(cut.round(new Volume(403, LOT), new Volume(15, LOT))).isEqualTo(new Volume(390, LOT)); }
public Volume round(final Volume volumeToRound, final Volume stepSize) { return new Volume(volumeToRound.asAbsolute() - volumeToRound.asAbsolute() % stepSize.asAbsolute(), VolumeUnit.BASE); }
VolumeStepSizeRounder { public Volume round(final Volume volumeToRound, final Volume stepSize) { return new Volume(volumeToRound.asAbsolute() - volumeToRound.asAbsolute() % stepSize.asAbsolute(), VolumeUnit.BASE); } }
VolumeStepSizeRounder { public Volume round(final Volume volumeToRound, final Volume stepSize) { return new Volume(volumeToRound.asAbsolute() - volumeToRound.asAbsolute() % stepSize.asAbsolute(), VolumeUnit.BASE); }  }
VolumeStepSizeRounder { public Volume round(final Volume volumeToRound, final Volume stepSize) { return new Volume(volumeToRound.asAbsolute() - volumeToRound.asAbsolute() % stepSize.asAbsolute(), VolumeUnit.BASE); }  Volume round(final Volume volumeToRound, final Volume stepSize); }
VolumeStepSizeRounder { public Volume round(final Volume volumeToRound, final Volume stepSize) { return new Volume(volumeToRound.asAbsolute() - volumeToRound.asAbsolute() % stepSize.asAbsolute(), VolumeUnit.BASE); }  Volume round(final Volume volumeToRound, final Volume stepSize);  }