Commit 33eb8a03 by Patryk Czarnik

wyplata

parent 0e28bb79
...@@ -49,4 +49,9 @@ public class Konto { ...@@ -49,4 +49,9 @@ public class Konto {
public void wplata(int kwota) { public void wplata(int kwota) {
saldo += kwota; saldo += kwota;
} }
public void wyplata(int kwota) {
saldo -= kwota;
}
} }
...@@ -10,6 +10,7 @@ class KontoTest { ...@@ -10,6 +10,7 @@ class KontoTest {
@BeforeEach @BeforeEach
void setUp() { void setUp() {
// Metoda setUp (oznaczona @BeforeEach) wykona się PRZED KAŻDYM TESTEM
konto = new Konto(1, 1000, new Osoba("Ala", "Kowalska", 30)); konto = new Konto(1, 1000, new Osoba("Ala", "Kowalska", 30));
} }
...@@ -21,4 +22,10 @@ class KontoTest { ...@@ -21,4 +22,10 @@ class KontoTest {
// za pomocą asercji sprawdzamy stan końcowy // za pomocą asercji sprawdzamy stan końcowy
assertEquals(1300, konto.getSaldo()); assertEquals(1300, konto.getSaldo());
} }
@Test
void testWyplata() {
konto.wyplata(400);
assertEquals(600, konto.getSaldo());
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment