diff --git a/Budget Projekt/bin/MeinBudgetView/MeinGui.class b/Budget Projekt/bin/MeinBudgetView/MeinGui.class index 657a70c..f1e48c8 100644 Binary files a/Budget Projekt/bin/MeinBudgetView/MeinGui.class and b/Budget Projekt/bin/MeinBudgetView/MeinGui.class differ diff --git a/Budget Projekt/bin/MeinBudgetView/MyTest.class b/Budget Projekt/bin/MeinBudgetView/MyTest.class new file mode 100644 index 0000000..486adef Binary files /dev/null and b/Budget Projekt/bin/MeinBudgetView/MyTest.class differ 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()); + + + } + +}