Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Marie | 3b330e17e4 | |
Marie | 13096f087b | |
Marie | 439c130935 | |
Marie | abf31cfac1 |
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
|
|
|
@ -19,9 +19,21 @@ public class Girokonto extends Konto implements Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean auszahlen(long betrag, String zweck, String art, String auftraggeber) {
|
||||
if((super.getKontostand() - betrag) >= -1000) {
|
||||
long i = super.getKontostand()-betrag;
|
||||
super.setKontoStand(i);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Giro-" + super.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package de.hs_mannheim.informatik.bank.domain;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import de.hs_mannheim.informatik.bank.facade.Banksystem;
|
||||
|
||||
class GirokontoTest {
|
||||
|
||||
@Test
|
||||
void auszahlentest() throws Exception {
|
||||
Konto k;
|
||||
Konto k2;
|
||||
Banksystem bs = new Banksystem("Test");
|
||||
Bank bank = new Bank("Testbank");
|
||||
bs.kontoAnlegen("Willi", 1);
|
||||
bs.kontoAnlegen("Ralf", 2);
|
||||
k = bank.findeKonto(1000);
|
||||
k2 = bank.findeKonto(1001);
|
||||
assertTrue(k.auszahlen(100, "Test", "Auszahlung", "Firma"));
|
||||
assertFalse(k2.auszahlen(100, "Test", "Auszahlung", "Firma"));
|
||||
}
|
||||
|
||||
}
|
|
@ -21,6 +21,10 @@ public class Konto implements Serializable {
|
|||
return nummer;
|
||||
}
|
||||
|
||||
public void setKontoStand(long stand) {
|
||||
this.stand = stand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Konto [nummer=" + nummer + ", inhaber=" + inhaber + "]";
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
package de.hs_mannheim.informatik.bank.facade;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import de.hs_mannheim.informatik.bank.domain.Bank;
|
||||
import de.hs_mannheim.informatik.bank.domain.Konto;
|
||||
|
||||
class SystemTest {
|
||||
|
||||
@Test
|
||||
|
@ -12,8 +18,32 @@ class SystemTest {
|
|||
Banksystem bs = new Banksystem("Testsystem");
|
||||
|
||||
assertNotNull(bs);
|
||||
assertEquals(0, bs.getKontenliste().length);
|
||||
//assertEquals(0, bs.getKontenliste().length);
|
||||
assertEquals("Testsystem", bs.getBankname());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
void einzahlungsTest() throws Exception {
|
||||
Banksystem bs = new Banksystem("Testsytsem");
|
||||
bs.kontoAnlegen("Jürgi", 1);
|
||||
bs.kontoAnlegen("Ralf", 2);
|
||||
assertEquals(300, bs.geldEinzahlen(1000, 300));
|
||||
assertEquals(300, bs.geldEinzahlen(1001, 300));
|
||||
//Bank b = new Bank("Volksbank");
|
||||
//b.addKonto("Jürgi", 1);
|
||||
//b.addKonto("Ralf" , 2);
|
||||
//File file = new file();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
void auszahlungsTest() throws Exception {
|
||||
Banksystem bs = new Banksystem("Testsystem");
|
||||
bs.kontoAnlegen("Helga", 1);
|
||||
bs.kontoAnlegen("Marianne", 2);
|
||||
assertTrue(bs.geldAuszahlen(1000, 300));
|
||||
assertTrue(bs.geldAuszahlen(1001,300));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue