Browse Source

Commit_19 setBalanceView() mit Tests implementiert

Eduard2
Adah Boukhari 5 years ago
parent
commit
737640d2b2
  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. 11
      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

@ -201,7 +201,7 @@ public class MeinGui extends JFrame implements ActionListener {
expenses = budget - Integer.parseInt(text2.getText()); expenses = budget - Integer.parseInt(text2.getText());
expensesDisplay.setText(setExpensesView()); expensesDisplay.setText(setExpensesView());
balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText());
setBalanceView();
balanceDisplay.setText(setBalanceView());
} }
} }
@ -229,8 +229,9 @@ public class MeinGui extends JFrame implements ActionListener {
return result; return result;
} }
public static void setBalanceView() {
balanceDisplay.setText(balance + " €");
public static String setBalanceView() {
String result = balance + " €";
return result;
} }
} }

11
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -25,4 +25,15 @@ class MyTest {
} }
@Test
public void testSetBalanceView() {
assertEquals(MeinGui.balance + " €", MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance, MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance + "€ " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance+ " € " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance*2 + " € ", MeinGui.setExpensesView());
}
} }
Loading…
Cancel
Save