@Test public void test() { final DefaultNetEarningsCalculator c = new DefaultNetEarningsCalculator(); final BookingBean b = TestUtils.getTestBooking(LocalDate.now(), LocalDate.now().plusDays(4)); b.setGrossEarningsExpression("360"); b.setServiceFee(0); b.setServiceFeesPercent(12f); b.setCleaningFees(60); final CleaningEntry ce = new CleaningEntry(LocalDate.now(), b, new Cleaning("testCleaning"), null); ce.setCleaningCosts(40); b.setCleaning(ce); assertEquals(360 - ((360 - 60) * 0.12), c.apply(b).doubleValue(), 0.001); }
@Override public Number apply(final BookingBean booking) { double result = booking.getGrossEarnings(); result -= (booking.getGrossEarnings() - booking.getCleaningFees()) * booking.getServiceFeesPercent() / 100.0; result -= booking.getServiceFee(); return result; }
DefaultNetEarningsCalculator implements NetEarningsCalculator { @Override public Number apply(final BookingBean booking) { double result = booking.getGrossEarnings(); result -= (booking.getGrossEarnings() - booking.getCleaningFees()) * booking.getServiceFeesPercent() / 100.0; result -= booking.getServiceFee(); return result; } }
DefaultNetEarningsCalculator implements NetEarningsCalculator { @Override public Number apply(final BookingBean booking) { double result = booking.getGrossEarnings(); result -= (booking.getGrossEarnings() - booking.getCleaningFees()) * booking.getServiceFeesPercent() / 100.0; result -= booking.getServiceFee(); return result; } DefaultNetEarningsCalculator(); }
DefaultNetEarningsCalculator implements NetEarningsCalculator { @Override public Number apply(final BookingBean booking) { double result = booking.getGrossEarnings(); result -= (booking.getGrossEarnings() - booking.getCleaningFees()) * booking.getServiceFeesPercent() / 100.0; result -= booking.getServiceFee(); return result; } DefaultNetEarningsCalculator(); @Override Number apply(final BookingBean booking); @Override Number apply(final BookingEntry booking); }
DefaultNetEarningsCalculator implements NetEarningsCalculator { @Override public Number apply(final BookingBean booking) { double result = booking.getGrossEarnings(); result -= (booking.getGrossEarnings() - booking.getCleaningFees()) * booking.getServiceFeesPercent() / 100.0; result -= booking.getServiceFee(); return result; } DefaultNetEarningsCalculator(); @Override Number apply(final BookingBean booking); @Override Number apply(final BookingEntry booking);  }