forked from hummel/Bank-System
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
WummerMIB | c119b04864 |
|
@ -20,6 +20,22 @@ public class Kunde implements Serializable{
|
|||
this.id++;
|
||||
}
|
||||
|
||||
public String getVorname() {
|
||||
return vorname;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getAlter() {
|
||||
return alter;
|
||||
}
|
||||
|
||||
public String getWohnort() {
|
||||
return wohnort;
|
||||
}
|
||||
|
||||
public void kundeHatKonte(Konto k) {
|
||||
konten.add(k);
|
||||
}
|
||||
|
@ -34,7 +50,8 @@ public class Kunde implements Serializable{
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vorname: " + this.vorname + " Name: " + this.name +" Alter: " + this.alter + " Wohnort: "+ this.wohnort;
|
||||
return "Vorname: " + this.vorname + " Name: " + this.name + " Alter: " + this.alter + " Wohnort: "
|
||||
+ this.wohnort;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package de.hs_mannheim.informatik.bank.domain;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class KundeTest {
|
||||
|
||||
@Test
|
||||
void testKontoBasic() {
|
||||
Kunde k = new Kunde("TestVor","TestNam",20,"TestHeim");
|
||||
assertEquals(1, k.getId());
|
||||
assertEquals("TestVor", k.getVorname());
|
||||
assertEquals("TestNam", k.getName());
|
||||
assertEquals(20, k.getAlter());
|
||||
assertEquals("TestHeim", k.getWohnort());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testKundeHatKonto() {
|
||||
Kunde ku = new Kunde("TestVor","TestNam",20,"TestHeim");
|
||||
Konto ko = new Konto("TestKonto",1);
|
||||
Konto gi = new Girokonto("TestGiro",2);
|
||||
Konto de = new Depot("Testdep",3);
|
||||
ku.kundeHatKonte(ko);
|
||||
ku.kundeHatKonte(gi);
|
||||
ku.kundeHatKonte(de);
|
||||
ArrayList<Konto> konten = new ArrayList<>();
|
||||
konten.add(ko);
|
||||
konten.add(gi);
|
||||
konten.add(de);
|
||||
assertTrue(konten.equals(ku.getKonten()));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue