Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
HFTSoftwareProject
testcases
Commits
416020ad
Commit
416020ad
authored
Sep 24, 2024
by
Younis
Browse files
Add new file FußballvereinTest
parent
643cd1d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
FußballvereinTest.java
0 → 100644
View file @
416020ad
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.util.HashMap
;
public
class
FußballvereinTest
{
private
Fußballverein
club
;
@Before
public
void
setUp
()
{
club
=
new
Fußballverein
();
}
@Test
public
void
testAddPlayer
()
{
club
.
addPlayer
(
"Lionel Messi"
,
10
);
club
.
addPlayer
(
"Cristiano Ronaldo"
,
7
);
HashMap
<
String
,
Integer
>
expected
=
new
HashMap
<>();
expected
.
put
(
"Lionel Messi"
,
10
);
expected
.
put
(
"Cristiano Ronaldo"
,
7
);
assertEquals
(
expected
,
club
.
getPlayers
());
}
@Test
public
void
testRemovePlayer
()
{
club
.
addPlayer
(
"Lionel Messi"
,
10
);
club
.
addPlayer
(
"Cristiano Ronaldo"
,
7
);
club
.
removePlayer
(
"Lionel Messi"
);
HashMap
<
String
,
Integer
>
expected
=
new
HashMap
<>();
expected
.
put
(
"Cristiano Ronaldo"
,
7
);
assertEquals
(
expected
,
club
.
getPlayers
());
}
@Test
public
void
testGetPlayerNumber
()
{
club
.
addPlayer
(
"Lionel Messi"
,
10
);
club
.
addPlayer
(
"Cristiano Ronaldo"
,
7
);
assertEquals
(
10
,
club
.
getPlayerNumber
(
"Lionel Messi"
));
assertEquals
(
7
,
club
.
getPlayerNumber
(
"Cristiano Ronaldo"
));
}
@Test
public
void
testGetPlayerNumberNonExistent
()
{
assertEquals
(-
1
,
club
.
getPlayerNumber
(
"Neymar"
));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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