Browse Source

Commit_33 setExpensesView() implementiert und getestet. Expenses reagiert beim Eingeben der Ausgaben

Mohamed
Adah Boukhari 5 years ago
parent
commit
ee3da7b36d
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MyTest.class
  3. 7
      Budget Projekt/src/MeinBudgetView/MeinGui.java
  4. 14
      Budget Projekt/src/MeinBudgetView/MyTest.java

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

BIN
Budget Projekt/bin/MeinBudgetView/MyTest.class

7
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -255,7 +255,7 @@ public class MeinGui extends JFrame implements ActionListener {
balance -= Double.parseDouble(text2.getText()); balance -= Double.parseDouble(text2.getText());
expenses += Double.parseDouble(text2.getText()); expenses += Double.parseDouble(text2.getText());
expensesDisplay.setText(setExpensesView());
balanceDisplay.setText(setBalanceView()); balanceDisplay.setText(setBalanceView());
} }
@ -286,4 +286,9 @@ public class MeinGui extends JFrame implements ActionListener {
return result; return result;
} }
public static String setExpensesView() {
String result = "-" + expenses + " €";
return result;
}
} }

14
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -32,4 +32,18 @@ class MyTest {
} }
@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());
}
} }
Loading…
Cancel
Save