diff --git a/src/test/java/edu/ntnu/idi/idatt2003/gruppe42/Model/PlayerTest.java b/src/test/java/edu/ntnu/idi/idatt2003/gruppe42/Model/PlayerTest.java index 6ca36bb..6e6c405 100644 --- a/src/test/java/edu/ntnu/idi/idatt2003/gruppe42/Model/PlayerTest.java +++ b/src/test/java/edu/ntnu/idi/idatt2003/gruppe42/Model/PlayerTest.java @@ -73,14 +73,10 @@ void withdrawExactAmountTest() { @Test void getNetworthTest() { - BigDecimal originalMoney = player.getMoney(); - Portfolio portfolio = player.getPortfolio(); - - Share share = new Share(new Stock("AAPL", "Apple Inc.", new BigDecimal("276.43")), new BigDecimal("10"), new BigDecimal("50")); - portfolio.addShare(share); - - player.getNetWorth(); - - assertEquals(originalMoney, player.getMoney()); + // Starting with 10000 money and adding 5000 moneys worth of AAPL then calculating the networth + // with commissions taken account of will result in this: + // 10000 + 5000 - (5000 * 0.01) = 14950 + player.getPortfolio().addShare(new Share(new Stock("AAPL", "Apple Inc.", new BigDecimal("5000")), new BigDecimal("1"), new BigDecimal("5000"))); + assertEquals(new BigDecimal("14950.00"), player.getNetWorth()); } }