Browse Source

Commit_18 setExpensesView() mit Tests implementiert

Eduard2
Adah Boukhari 5 years ago
parent
commit
eb61cb1f13
  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. 8
      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

@ -199,7 +199,7 @@ public class MeinGui extends JFrame implements ActionListener {
if (ae.getSource() == this.berechne && (text1 != null && text2 != null)) { if (ae.getSource() == this.berechne && (text1 != null && text2 != null)) {
expenses = budget - Integer.parseInt(text2.getText()); expenses = budget - Integer.parseInt(text2.getText());
setExpensesView();
expensesDisplay.setText(setExpensesView());
balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText());
setBalanceView(); setBalanceView();
} }
@ -224,8 +224,9 @@ public class MeinGui extends JFrame implements ActionListener {
return result; return result;
} }
public static void setExpensesView() {
expensesDisplay.setText(expenses - budget + " €");
public static String setExpensesView() {
String result = expenses - budget + " €";
return result;
} }
public static void setBalanceView() { public static void setBalanceView() {

8
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -13,7 +13,15 @@ class MyTest {
assertNotEquals(MeinGui.budget + "€ ", MeinGui.setBudgetView()); assertNotEquals(MeinGui.budget + "€ ", MeinGui.setBudgetView());
assertNotEquals(MeinGui.budget + " € ", MeinGui.setBudgetView()); assertNotEquals(MeinGui.budget + " € ", MeinGui.setBudgetView());
assertNotEquals(MeinGui.budget + " ", MeinGui.setBudgetView()); assertNotEquals(MeinGui.budget + " ", MeinGui.setBudgetView());
}
@Test
public void testSetExpensesView() {
assertEquals(MeinGui.expenses - MeinGui.budget + " €", MeinGui.setExpensesView());
assertNotEquals(MeinGui.expenses - MeinGui.budget, MeinGui.setExpensesView());
assertNotEquals(MeinGui.expenses - MeinGui.budget + "€ " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.expenses - MeinGui.budget + " € " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.expenses - MeinGui.budget + "", MeinGui.setExpensesView());
} }

Loading…
Cancel
Save