public void testSubtractFundsActuallyRemovesCorrectFundsToBalanceValue() throws Exception { UserBalanceInterface userBalance = new UserBalance(); userBalance.addFunds(InsertedCoinPiece.QUARTER); userBalance.addFunds(InsertedCoinPiece.QUARTER); userBalance.addFunds(InsertedCoinPiece.DIME); double expectedUserBalanceAsFractionOfDollar = .60; assertEquals(expectedUserBalanceAsFractionOfDollar, userBalance.getBalanceValue()); userBalance.subtractFunds(".50"); double expectedUserBalanceAsFractionOfDollarAfterSubtractingFunds = .10; assertEquals( expectedUserBalanceAsFractionOfDollarAfterSubtractingFunds, userBalance.getBalanceValue()); }
public void testAddFundsActuallyAddsCorrectFundsToBalanceValue() throws Exception { UserBalanceInterface userBalance = new UserBalance(); userBalance.addFunds(InsertedCoinPiece.QUARTER); double expectedBalanceValueAsFractionOfADollar = .25; assertEquals( "Make certain that the conversion to fraction of a dollar is .01!", expectedBalanceValueAsFractionOfADollar, userBalance.getBalanceValue()); }