Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kurs_java_alx_20240321
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
kurs_java_alx_20240321
Commits
15c00c5f
Commit
15c00c5f
authored
Apr 12, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setUp
parent
62404559
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
KontoTest.java
src/p11_klasy/enkapsulacja/KontoTest.java
+9
-4
No files found.
src/p11_klasy/enkapsulacja/KontoTest.java
View file @
15c00c5f
...
...
@@ -2,14 +2,21 @@ package p11_klasy.enkapsulacja;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
class
KontoTest
{
private
Konto
konto
;
@BeforeEach
void
setUp
()
{
// ta metoda wykona się przed każdym testem
// wykorzystamy ją do inicjalizacji obiektów potrzebnych w teście - konto
konto
=
new
Konto
(
1
,
1000
,
new
Osoba
(
"Ala"
,
"Kowalska"
,
"2000-01-01"
));
}
@Test
void
testWplata
()
{
Osoba
ala
=
new
Osoba
(
"Ala"
,
"Kowalska"
,
"2000-01-01"
);
Konto
konto
=
new
Konto
(
1
,
1000
,
ala
);
konto
.
wplata
(
300
);
// w testach jednostkowych nie pritnujemy danych na ekran, tylko sprawdzamy za pomocą "sercji" czy wyniki się zgadzają
// assert konto.getSaldo() == 1300;
...
...
@@ -19,8 +26,6 @@ class KontoTest {
@Test
void
testWyplata
()
throws
BrakSrodkow
{
Osoba
ala
=
new
Osoba
(
"Ala"
,
"Kowalska"
,
"2000-01-01"
);
Konto
konto
=
new
Konto
(
1
,
1000
,
ala
);
konto
.
wyplata
(
200
);
assertEquals
(
800
,
konto
.
getSaldo
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment