-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit tests for Player and improved tests for Exchange and Portfolio
- Loading branch information
Showing
3 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/java/edu/ntnu/idi/idatt2003/gruppe42/PlayerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import edu.ntnu.idi.idatt2003.gruppe42.Model.Player; | ||
| import java.math.BigDecimal; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class PlayerTest { | ||
| private Player player; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| player = new Player("John Doe", new BigDecimal("10000")); | ||
| } | ||
|
|
||
| @Test | ||
| void addMoneyTest() { | ||
| player.addMoney(new BigDecimal("5000")); | ||
| assertEquals(new BigDecimal("15000"), player.getMoney()); | ||
| } | ||
|
|
||
| @Test | ||
| void withdrawMoneyTest() { | ||
| player.withdrawMoney(new BigDecimal("5000")); | ||
| assertEquals(new BigDecimal("5000"), player.getMoney()); | ||
| } | ||
| } |
32 changes: 17 additions & 15 deletions
32
src/test/java/edu/ntnu/idi/idatt2003/gruppe42/PortfolioTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters