package BankSystemGUI;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;

import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class JTest {
	User obai;
	Konto obai_konto, obai_konto2;
	
	User omar;
	Konto omar_konto;
	
	Bank bank;
	
	@BeforeEach
	void erstelle_Objekt() {
		obai = new User("Obai","albek");
		obai_konto = new Konto(0,obai);
		obai_konto2 = new Konto(0,obai);
		
		omar = new User("Omar","Albek");
		omar_konto = new Konto(0,omar);
		
		bank = new Bank("SparKasse");
		
		bank.kunde_Hinzufuegen(obai);
		bank.kunde_Hinzufuegen(omar);
		
	}
	
	@Test
	public void sucheKunden() throws Exception {
	
		assertEquals(omar.toString(),bank.getKunde(1003));
	}
	
	@Test
	void testeinzahlen() throws Exception {
		obai_konto.einzahlen(50);
		assertEquals(50,obai_konto.getKontostand());

		obai_konto2.einzahlen(100);
		assertEquals(100,obai_konto2.getKontostand());
		
		omar_konto.einzahlen(100);
		assertEquals(100,omar_konto.getKontostand());
		
	}
	

}
