UnitTests
parent
8975d33a1b
commit
feeb32f6fe
Binary file not shown.
|
@ -32,4 +32,20 @@ class KontoTest {
|
|||
assertEquals(50, k2.getKontostand());
|
||||
}
|
||||
|
||||
@Test
|
||||
void dispoTest() {
|
||||
Girokonto ausgang = new Girokonto("Ausgang", 0);
|
||||
Girokonto ziel = new Girokonto("Ziel", 1);
|
||||
//Überweisung
|
||||
ausgang.überweise(ziel, 100, "Überweisung");
|
||||
assertEquals(-100, ausgang.getKontostand());
|
||||
assertEquals(100, ziel.getKontostand());
|
||||
|
||||
//Abheben
|
||||
ausgang.einzahlen(100, "Einzahlung", "ka", "ka");
|
||||
assertEquals(0, ausgang.getKontostand());
|
||||
ausgang.auszahlen(-100, "Auszahlung", "ka", "ka");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package de.hs_mannheim.informatik.bank.facade;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -16,4 +18,26 @@ class SystemTest {
|
|||
assertEquals("Testsystem", bs.getBankname());
|
||||
}
|
||||
|
||||
@Test
|
||||
void geldEinzahlen() throws Exception {
|
||||
Banksystem bs = new Banksystem("UnitBank");
|
||||
bs.kontoAnlegen("TestKonto", 1);
|
||||
assertEquals(0l, bs.getKontostand(1000));
|
||||
bs.geldEinzahlen(1000, 200l);
|
||||
assertEquals(200l, bs.getKontostand(1000));
|
||||
File x = new File(bs.getBankname() + "-bank-data.ser");
|
||||
assertTrue(x.delete());
|
||||
}
|
||||
|
||||
@Test
|
||||
void geldAuszahlen() throws Exception {
|
||||
Banksystem bs = new Banksystem("UnitBank");
|
||||
bs.kontoAnlegen("TestKonto", 1);
|
||||
bs.geldEinzahlen(1000, 200l);
|
||||
bs.geldAuszahlen(1000, 100l);
|
||||
assertEquals(100l, bs.getKontostand(1000));
|
||||
|
||||
File x = new File(bs.getBankname() + "-bank-data.ser");
|
||||
assertTrue(x.delete());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue