Browse Source

Konflikt behoben

master
Adah Boukhari 5 years ago
parent
commit
209b103119
  1. BIN
      Budget Projekt/Image/exit.png
  2. BIN
      Budget Projekt/Image/leeren.png
  3. BIN
      Budget Projekt/bin/MeinBudgetView/MyTest.class
  4. BIN
      Budget Projekt/bin/exit.png
  5. BIN
      Budget Projekt/bin/leeren.png
  6. 17
      Budget Projekt/src/MeinBudgetView/MeinGui.java
  7. 44
      Budget Projekt/src/MeinBudgetView/MyTest.java

BIN
Budget Projekt/Image/exit.png

After

Width: 48  |  Height: 48  |  Size: 4.4 KiB

BIN
Budget Projekt/Image/leeren.png

After

Width: 48  |  Height: 48  |  Size: 1.8 KiB

BIN
Budget Projekt/bin/MeinBudgetView/MyTest.class

BIN
Budget Projekt/bin/exit.png

After

Width: 48  |  Height: 48  |  Size: 4.4 KiB

BIN
Budget Projekt/bin/leeren.png

After

Width: 48  |  Height: 48  |  Size: 1.8 KiB

17
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -250,14 +250,15 @@ public class MeinGui extends JFrame implements ActionListener {
}
if (ae.getSource() == this.berechne && (text1 != null && text2 != null)) {
expenses = budget - Double.parseDouble(text2.getText());
DefaultTableModel tab = (DefaultTableModel) myTable.getModel();
tab.addRow(new Object[] { (textExpensesName.getText()), Double.parseDouble(text2.getText()) });
balance -= Double.parseDouble(text2.getText());
expenses += Double.parseDouble(text2.getText());
expensesDisplay.setText(setExpensesView());
balance = Double.parseDouble(text1.getText()) - Double.parseDouble(text2.getText());
balanceDisplay.setText(setBalanceView());
}
DefaultTableModel tab = (DefaultTableModel)myTable.getModel();
tab.addRow(new Object [] {(textExpensesName.getText()) , Double.parseDouble(text2.getText())});
}
@ -280,13 +281,13 @@ public class MeinGui extends JFrame implements ActionListener {
return result;
}
public static String setExpensesView() {
String result = expenses - budget + " €";
public static String setBalanceView() {
String result = budget - expenses + " €";
return result;
}
public static String setBalanceView() {
String result = balance + " €";
public static String setExpensesView() {
String result = "-" + expenses + " €";
return result;
}

44
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -8,31 +8,41 @@ 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());
MeinGui.budget = 2000.;
assertEquals(2000.0 + " €", MeinGui.setBudgetView());
assertNotEquals(2000 + " €", MeinGui.setBudgetView());
assertNotEquals(2000.0 + "€ ", MeinGui.setBudgetView());
assertNotEquals(2000 + " €", MeinGui.setBudgetView());
assertNotEquals(2000.0 + "€", 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());
public void testSetBalanceView() {
MeinGui.budget = 2000.;
MeinGui.expenses = 405.;
assertEquals(1595.0 + " €", MeinGui.setBalanceView());
assertNotEquals(1595 + " €", MeinGui.setBalanceView());
assertNotEquals(1595 + "€ ", MeinGui.setBalanceView());
assertNotEquals(1595 + "€", MeinGui.setBalanceView());
assertNotEquals(null, MeinGui.setBalanceView());
}
@Test
public void testSetBalanceView() {
assertEquals(MeinGui.balance + " €", MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance, MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance + "€ " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance+ " € " , MeinGui.setExpensesView());
assertNotEquals(MeinGui.balance*2 + " € ", MeinGui.setExpensesView());
public void testSetExpensesView() {
MeinGui.expenses = 1234;
assertEquals("-" + 1234.0 + " €", MeinGui.setExpensesView());
assertNotEquals(1234.0 + " €", MeinGui.setExpensesView());
assertNotEquals(null, MeinGui.setBalanceView());
MeinGui.expenses = 4321.;
assertEquals("-" + 4321.0 + " €", MeinGui.setExpensesView());
assertNotEquals("-" + 4321 + " €", MeinGui.setExpensesView());
assertNotEquals("-" + 4321.0 + "€", MeinGui.setExpensesView());
}

Loading…
Cancel
Save