-
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.
Revert "Feat: Updated playerstatuscontroller and tests"
This reverts commit fe6f10b.
- Loading branch information
Showing
2 changed files
with
38 additions
and
46 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
46 changes: 10 additions & 36 deletions
46
src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/model/PlayerStatusTest.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 |
|---|---|---|
| @@ -1,49 +1,23 @@ | ||
| package edu.ntnu.idi.idatt2003.g40.mappe.model; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.controller.PlayerStatusController; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class PlayerStatusTest { | ||
| import java.math.BigDecimal; | ||
|
|
||
| /** | ||
| * Player object used for testing. | ||
| * */ | ||
| private Player testPlayer; | ||
| import static org.junit.jupiter.api.Assertions.*; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| testPlayer = new Player("Player", new BigDecimal(1000)); | ||
| } | ||
| class PlayerStatusTest { | ||
|
|
||
| @Test | ||
| void getStatusAtStartReturnsWorstStatus() { | ||
| assertEquals(PlayerStatus.NOOB, testPlayer.getStatus()); | ||
| } | ||
| void getStatusReturnsProperStatuses() { | ||
| Player testPlayer = new Player("Player", new BigDecimal(1000)); | ||
| PlayerStatus gottenStatus = PlayerStatusController.getStatus(testPlayer); | ||
| assertEquals(PlayerStatus.NOOB, gottenStatus); | ||
|
|
||
| @Test | ||
| void getStatusAfterDoubleIncreaseReturnsBetterStatus() { | ||
| testPlayer.addMoney(new BigDecimal(1000)); | ||
| assertEquals(PlayerStatus.TRYHARD, testPlayer.getStatus()); | ||
| } | ||
|
|
||
| @Test | ||
| void gettingStatusWhenNegativeDifferenceReturnsWorstStatus() { | ||
| testPlayer.addMoney(new BigDecimal(-1000)); | ||
| assertEquals(PlayerStatus.NOOB, testPlayer.getStatus()); | ||
| } | ||
|
|
||
| @Test | ||
| void multipleChangesInValueCauseCorrectStatus() { | ||
| testPlayer.addMoney(new BigDecimal(2000)); | ||
| assertEquals(PlayerStatus.PRO, testPlayer.getStatus()); | ||
|
|
||
| testPlayer.addMoney(new BigDecimal(-1000)); | ||
| assertEquals(PlayerStatus.TRYHARD, testPlayer.getStatus()); | ||
| PlayerStatus gottenStatus2 = PlayerStatusController.getStatus(testPlayer); | ||
|
|
||
| testPlayer.addMoney(new BigDecimal(-500)); | ||
| assertEquals(PlayerStatus.GOOD, testPlayer.getStatus()); | ||
| assertEquals(PlayerStatus.TRYHARD, gottenStatus2); | ||
| } | ||
| } |