Browse Source

Commit_17 setBudgetView() mit Tests implementiert

Eduard2
Adah Boukhari 5 years ago
parent
commit
f16177acb6
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MyTest.class
  3. 24
      Budget Projekt/src/MeinBudgetView/MeinGui.java
  4. 20
      Budget Projekt/src/MeinBudgetView/MyTest.java

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

BIN
Budget Projekt/bin/MeinBudgetView/MyTest.class

24
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() {

20
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());
}
}
Loading…
Cancel
Save