### Question:
SplitRequest extends BaseModel { @NonNull public Amounts getRemainingAmounts() { if (transactions.isEmpty()) { return getRequestedAmounts(); } Amounts processed = getProcessedAmounts(); return Amounts.subtractAmounts(getRequestedAmounts(), processed, false); } SplitRequest();  SplitRequest(Payment sourcePayment, Amounts accumulatedRequestTotals, List<Transaction> transactions); @NonNull Payment getSourcePayment(); @NonNull List<Transaction> getTransactions(); boolean hasPreviousTransactions(); @Nullable Transaction getLastTransaction(); @NonNull Amounts getRequestedAmounts(); @NonNull Amounts getRemainingAmounts(); @NonNull Amounts getProcessedAmounts(); void setDeviceAudience(DeviceAudience deviceAudience); @NonNull DeviceAudience getDeviceAudience(); @Override String toJson(); static SplitRequest fromJson(String json);  }### Answer:
@Test public void shouldCalculateRemainingAmountsCorrectly() throws Exception { setupSplitRequestWith75PercentProcessed(); Amounts remainingAmounts = splitRequest.getRemainingAmounts(); assertThat(remainingAmounts).isEqualTo(new Amounts(TOTAL_AMOUNT / 4, CURRENCY)); }
@Test public void remainingShouldReturnRequestAmountsIfNothingProcessed() throws Exception { setupWithNothingProcessed(); Amounts remainingAmounts = splitRequest.getRemainingAmounts(); assertThat(remainingAmounts).isEqualTo(new Amounts(TOTAL_AMOUNT, CURRENCY)); }
@Test public void remainingShouldReturnZeroIfAllProcessed() throws Exception { setupWithAllProcessed(); Amounts remainingAmounts = splitRequest.getRemainingAmounts(); assertThat(remainingAmounts).isEqualTo(new Amounts(0, CURRENCY)); }