You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

package MeinBudgetView;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class MyTest {
@Test
public void testSetBudgetView() {
MeinGui.budget = 2000.;
assertEquals(2000.0 + " €", MeinGui.setBudgetView());
assertNotEquals(2000 + " €", MeinGui.setBudgetView());
assertNotEquals(2000.0 + "€ ", MeinGui.setBudgetView());
assertNotEquals(2000 + " €", MeinGui.setBudgetView());
assertNotEquals(2000.0 + "€", MeinGui.setBudgetView());
}
@Test
public void testSetBalanceView() {
MeinGui.budget = 2000.;
MeinGui.expenses = 405.;
assertEquals(1595.0 + " €", MeinGui.setBalanceView());
assertNotEquals(1595 + " €", MeinGui.setBalanceView());
assertNotEquals(1595 + "€ ", MeinGui.setBalanceView());
assertNotEquals(1595 + "€", MeinGui.setBalanceView());
assertNotEquals(null, MeinGui.setBalanceView());
}
@Test
public void testSetExpensesView() {
MeinGui.expenses = 1234;
assertEquals("-" + 1234.0 + " €", MeinGui.setExpensesView());
assertNotEquals(1234.0 + " €", MeinGui.setExpensesView());
assertNotEquals(null, MeinGui.setBalanceView());
MeinGui.expenses = 4321.;
assertEquals("-" + 4321.0 + " €", MeinGui.setExpensesView());
assertNotEquals("-" + 4321 + " €", MeinGui.setExpensesView());
assertNotEquals("-" + 4321.0 + "€", MeinGui.setExpensesView());
}
}