Skip to content

Commit

Permalink
fix: Changed test after changing return.
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Apr 20, 2026
1 parent 6977a21 commit df49c31
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/millions/model/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void withdrawMoney(BigDecimal amount) {
}

public String getStatus() {
// TODO dobbel sjekk logikken
int weeksTraded = transactionArchive.countDistinctWeeks();

String status = "Novice";
Expand Down
22 changes: 18 additions & 4 deletions src/test/java/millions/ExchangeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ public void testGetGainers() {
exchange.advance();
List<Stock> gainers = exchange.getGainers(3);

boolean isSorted = IntStream.range(0, gainers.size() -1)
.allMatch(i -> gainers.get(i).getLatestPriceChange().compareTo(gainers.get(i+1).getLatestPriceChange()) <= 0);
boolean isSorted =
IntStream.range(0, gainers.size() - 1)
.allMatch(
i ->
gainers
.get(i)
.getLatestPriceChange()
.compareTo(gainers.get(i + 1).getLatestPriceChange())
>= 0);

assertTrue(isSorted);
assertEquals(3, gainers.size());
Expand All @@ -112,8 +119,15 @@ public void testGetLosers() {
for (Stock s : losers) {
System.out.println(s.getLatestPriceChange());
}
boolean isSorted = IntStream.range(0, losers.size() -1)
.allMatch(i -> losers.get(i).getLatestPriceChange().compareTo(losers.get(i+1).getLatestPriceChange()) <= 0);
boolean isSorted =
IntStream.range(0, losers.size() - 1)
.allMatch(
i ->
losers
.get(i)
.getLatestPriceChange()
.compareTo(losers.get(i + 1).getLatestPriceChange())
<= 0);

assertTrue(isSorted);
assertEquals(3, losers.size());
Expand Down

0 comments on commit df49c31

Please sign in to comment.