From f16177acb6396f54008d424fc07fa1fa9a11d2a2 Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Sun, 2 Feb 2020 02:10:52 +0100 Subject: [PATCH] Commit_17 setBudgetView() mit Tests implementiert --- .../bin/MeinBudgetView/MeinGui.class | Bin 5790 -> 5832 bytes .../bin/MeinBudgetView/MyTest.class | Bin 0 -> 1065 bytes .../src/MeinBudgetView/MeinGui.java | 24 ++++++++++-------- Budget Projekt/src/MeinBudgetView/MyTest.java | 20 +++++++++++++++ 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 Budget Projekt/bin/MeinBudgetView/MyTest.class create mode 100644 Budget Projekt/src/MeinBudgetView/MyTest.java diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui.class b/Budget Projekt/bin/MeinBudgetView/MeinGui.class index 657a70c9a0a944899af1b79d1bdc58180d9dfd56..f1e48c89da014d6f7979d0e5d3399a2774cd44be 100644 GIT binary patch delta 685 zcmZuvO=}ZT6g_v+Bz-S0M)TR2R2vteO-&0Hl;TE;MQVjE6hWk7AY*7Lp>(FTi-K!G zS8wlcuu~WZ1(zjOOK>B)(nSSbxe($)wBDHvQo$K`=YF1h=DvAS@6_eq@8>T8oTrIx zxg{5SgrsHKGwaQkY2REj?@Me@M9}~)5aOJ8_lMWhfV?tUi?}Q$#N$I_21!X|1o=g!HxL#ztdurO|FpUbokl z+O3N^r!ENr0m&MLzM~e#1PVy{9)?0JhIkUCAkMmc+eE0B!3;ITLhonbJZ)Iz@=g`4jyuvE>VBs|$;td|5 ziwUOB_lMv;KCs8*C`HG40VmiV#6T)J{u47Gd_$Gb5spqV5@R&tQCd^(awX4G(~B-K z?)zvs=!W<y7Bq~!G)mU zcJ|`GV1#(7=u+aNh&$c1P(l9y1##iy+?y=AC^!T2ojEh-o8Qb7Q`;$V`ttJ#KtFZu zidE5?Bm~AyYj`0$V_K8n%q1N}6%vhz363fyRjET!U+t5Kmr_EKU)_k2fgpvvR7(iv zGK-m>ADOwCp7E7=%bb;nU{K&Y8Ir;nAb96ZYr*?3iHBN^9h@^HR@ zdmE3uR0^_tr&@&*kl9)(Nto4@3bOXgf#=Whu{Vrv@LX5TOV%je$wQ|!loST0=_ d=XKs=xn-6+$F9jm)2Q8nr4H(JaR~`lZg0PqcE11s diff --git a/Budget Projekt/bin/MeinBudgetView/MyTest.class b/Budget Projekt/bin/MeinBudgetView/MyTest.class new file mode 100644 index 0000000000000000000000000000000000000000..486adefba5157076ba69697538ab12f19fb19432 GIT binary patch literal 1065 zcmZ`%TT|0O7(H7mDIr)|3&=%{S6UR}6)!~;9Cer}Fj}TFKBnzjw-b_@Y;b(_MShGg z`T!lB@zDo=hCjsd+oWS#C=c0W_k20uIcLA$f4~0(u#Be~5)2cYT)69Dy}@Ng@DJAJ z#~mI>4M~RaroCrdj_o$A?P`2zwC9h^X726kT-#JXmcOqbzDh+I2WXMPoQRcEMjA8n9=t{B6D zw59M|Vwx*?e#2^pB#zdWkleTImavqUqJ}K>>Y6D_U$~9+P&jq&k06Ih4HFELN5xPu zFGFEq3TMfAHOh#AZRnW6oQB!Hgkn+y=Ww1u+q0dJZ@;B@^BaZI(bh#B8JH@vi>l%{ zUZ|vSnc_A7eEOnluNt_9c@kl_THLKOEDrkV7*EGy)UIG)0oNH)(u<`sCNb4w3pA!8)x91{I9bYQzQf9-|$@X+jf7cdEvtI^Y-4tAF-?AoJ!M z&a^Rohzr?E2e@*8d>c2~u==5UJ<$Dr=+Vj0%E?e4Vb{wH=><8NB?rso;T1V>NdISK Pd;IPH_qR&b2|W1+T44bi literal 0 HcmV?d00001 diff --git a/Budget Projekt/src/MeinBudgetView/MeinGui.java b/Budget Projekt/src/MeinBudgetView/MeinGui.java index d975fe5..3e590a1 100644 --- a/Budget Projekt/src/MeinBudgetView/MeinGui.java +++ b/Budget Projekt/src/MeinBudgetView/MeinGui.java @@ -24,8 +24,8 @@ import javax.swing.JSeparator; public class MeinGui extends JFrame implements ActionListener { private JPanel contentPane; - private static JTextField text1; - private static JTextField text2; + public static JTextField text1; + public static JTextField text2; JLabel labelBudgetImage; JLabel labelExpensesImage; JLabel labelBalancetImage; @@ -35,12 +35,12 @@ public class MeinGui extends JFrame implements ActionListener { JLabel leeren; JButton loeschen; JButton exit; - private static JLabel budgetDispaly; - private static JLabel expensesDisplay; - private static JLabel balanceDisplay; - private static int budget; - private static int expenses; - private static int balance; + public static JLabel budgetDispaly; + public static JLabel expensesDisplay; + public static JLabel balanceDisplay; + public static int budget; + public static int expenses; + public static int balance; /** * Launch the application. @@ -194,7 +194,7 @@ public class MeinGui extends JFrame implements ActionListener { budget = Integer.parseInt(text1.getText()); if (ae.getSource() == this.senden && (text1 != null && text2 != null)) { - SetBudgetView(); + budgetDispaly.setText(setBudgetView()); } if (ae.getSource() == this.berechne && (text1 != null && text2 != null)) { @@ -218,8 +218,10 @@ public class MeinGui extends JFrame implements ActionListener { balanceDisplay.setText(""); } - public static void SetBudgetView() { - budgetDispaly.setText(budget + " €"); + + public static String setBudgetView() { + String result = budget + " €"; + return result; } public static void setExpensesView() { diff --git a/Budget Projekt/src/MeinBudgetView/MyTest.java b/Budget Projekt/src/MeinBudgetView/MyTest.java new file mode 100644 index 0000000..6f9308a --- /dev/null +++ b/Budget Projekt/src/MeinBudgetView/MyTest.java @@ -0,0 +1,20 @@ +package MeinBudgetView; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class MyTest { + + @Test + public void testSetBudgetView() { + assertEquals(MeinGui.budget + " €", MeinGui.setBudgetView()); + assertNotEquals(MeinGui.budget + " ", MeinGui.setBudgetView()); + assertNotEquals(MeinGui.budget + "€ ", MeinGui.setBudgetView()); + assertNotEquals(MeinGui.budget + " € ", MeinGui.setBudgetView()); + assertNotEquals(MeinGui.budget + " ", MeinGui.setBudgetView()); + + + } + +}