From eb61cb1f13843d0bad4247b2e6c9c867acd091b2 Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Sun, 2 Feb 2020 02:38:37 +0100 Subject: [PATCH] Commit_18 setExpensesView() mit Tests implementiert --- .../bin/MeinBudgetView/MeinGui.class | Bin 5832 -> 5844 bytes .../bin/MeinBudgetView/MyTest.class | Bin 1065 -> 1429 bytes .../src/MeinBudgetView/MeinGui.java | 7 ++++--- Budget Projekt/src/MeinBudgetView/MyTest.java | 12 ++++++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui.class b/Budget Projekt/bin/MeinBudgetView/MeinGui.class index f1e48c89da014d6f7979d0e5d3399a2774cd44be..98894d705627e0fa1d6426c0f385b84714c52181 100644 GIT binary patch delta 200 zcmX@1dqsD{J}$;@oA+~hb8<1VGB5!l1HxH=3rpq=hgnr;IWxol#Nm58v`SQ0#MkSfd$B7V36I-C?2^9WWnE*$yY=b lMV~N8Gdu;G$^%p&&A`N{$*46sR?LOrD)K#~4gEF_au*(BH)H7s%Mg z@OcNr_ms_ytUDOlC-;i@n-(*iX6R%%!_dQUo}R8u3A7(<>7a6cted{}xA*ng zAj8Z%ERa`N`V-i4x#X}+Ns;vb4%n=)7GqVBKJZRG_t0xL+-ft>4SnJ;PF0aDR;Oxx zaMrZgPzlG8+yk{XlqNK_nL-jm+xGS?-u+hg>W!q7y> zWJs~cVh{HlRo;EMzkTLc`#*R+-1}MA&%YijcO;B~EjlJaksm5Bf=iYfHQ0OubHiId delta 60 zcmbQry^@3L)W2Q(7#JAL7#ucoU1pk`$*jW2w7HL&i&0jHfg32n!@vk6JAgDVkY;4C J1CmS(_5jDb3V#3q diff --git a/Budget Projekt/src/MeinBudgetView/MeinGui.java b/Budget Projekt/src/MeinBudgetView/MeinGui.java index 3e590a1..295d3bf 100644 --- a/Budget Projekt/src/MeinBudgetView/MeinGui.java +++ b/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)) { expenses = budget - Integer.parseInt(text2.getText()); - setExpensesView(); + expensesDisplay.setText(setExpensesView()); balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); setBalanceView(); } @@ -224,8 +224,9 @@ public class MeinGui extends JFrame implements ActionListener { return result; } - public static void setExpensesView() { - expensesDisplay.setText(expenses - budget + " €"); + public static String setExpensesView() { + String result = expenses - budget + " €"; + return result; } public static void setBalanceView() { diff --git a/Budget Projekt/src/MeinBudgetView/MyTest.java b/Budget Projekt/src/MeinBudgetView/MyTest.java index 6f9308a..8cfc758 100644 --- a/Budget Projekt/src/MeinBudgetView/MyTest.java +++ b/Budget Projekt/src/MeinBudgetView/MyTest.java @@ -13,8 +13,16 @@ class MyTest { 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()); + } }