-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#764 - global account select: show warning icons if the end date of a…
…n account will soon be reached or is already reached
- Loading branch information
1 parent
667c7d9
commit ae6d062
Showing
7 changed files
with
93 additions
and
6 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
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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/unit/AccountTest.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,48 @@ | ||
package de.deadlocker8.budgetmaster.unit; | ||
|
||
import de.deadlocker8.budgetmaster.accounts.Account; | ||
import de.deadlocker8.budgetmaster.accounts.AccountType; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDate; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class AccountTest | ||
{ | ||
|
||
@Test | ||
void test_getRemainingDays_NoEndDate() | ||
{ | ||
final Account account = new Account("account", "", AccountType.CUSTOM, null); | ||
assertThat(account.getRemainingDays()) | ||
.isNull(); | ||
} | ||
|
||
@Test | ||
void test_getRemainingDays_EndDateNotReached() | ||
{ | ||
final LocalDate today = LocalDate.now(); | ||
final Account account = new Account("account", "", AccountType.CUSTOM, today.plusDays(30)); | ||
assertThat(account.getRemainingDays()) | ||
.isEqualTo(30); | ||
} | ||
|
||
@Test | ||
void test_getRemainingDays_EndDateExactlyReached() | ||
{ | ||
final LocalDate today = LocalDate.now(); | ||
final Account account = new Account("account", "", AccountType.CUSTOM, today); | ||
assertThat(account.getRemainingDays()) | ||
.isZero(); | ||
} | ||
|
||
@Test | ||
void test_getRemainingDays_EndDateReached() | ||
{ | ||
final LocalDate today = LocalDate.now(); | ||
final Account account = new Account("account", "", AccountType.CUSTOM, today.minusDays(5)); | ||
assertThat(account.getRemainingDays()) | ||
.isEqualTo(-5); | ||
} | ||
} |