Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pa165 Ice Hockey Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomáš Madeja
pa165 Ice Hockey Manager
Commits
f8c481c0
There was an error fetching the commit references. Please try again later.
Commit
f8c481c0
authored
3 years ago
by
Erik Moravec
Browse files
Options
Downloads
Patches
Plain Diff
test: fixed test for add away games and added remove home games tests
parent
4f814b88
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/cz/muni/fi/pa165/icehockeymanager/services/TeamServiceImplTest.java
+29
-2
29 additions, 2 deletions
.../pa165/icehockeymanager/services/TeamServiceImplTest.java
with
29 additions
and
2 deletions
src/test/java/cz/muni/fi/pa165/icehockeymanager/services/TeamServiceImplTest.java
+
29
−
2
View file @
f8c481c0
...
...
@@ -166,7 +166,7 @@ class TeamServiceImplTest {
Team
team
=
buildTeam
(
"Florida Panthers"
);
Game
game
=
buildGame
();
teamService
.
addAwayGame
(
team
,
game
);
assertThat
(
team
.
get
Home
Games
()).
hasSameElementsAs
(
List
.
of
(
game
));
assertThat
(
team
.
get
Away
Games
()).
hasSameElementsAs
(
List
.
of
(
game
));
verify
(
teamDao
).
update
(
team
);
}
...
...
@@ -176,7 +176,7 @@ class TeamServiceImplTest {
assertThatExceptionOfType
(
NullPointerException
.
class
).
isThrownBy
(
()
->
teamService
.
addAwayGame
(
team
,
null
)
);
assertThat
(
team
.
get
Home
Games
()).
hasSameElementsAs
(
List
.
of
());
assertThat
(
team
.
get
Away
Games
()).
hasSameElementsAs
(
List
.
of
());
}
@Test
...
...
@@ -187,6 +187,33 @@ class TeamServiceImplTest {
);
}
@Test
public
void
removeHomeGame
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
Game
game
=
buildGame
();
team
.
setHomeGames
(
Set
.
of
(
game
));
teamService
.
removeHomeGame
(
team
,
game
);
assertThat
(
team
.
getHomeGames
()).
hasSameElementsAs
(
List
.
of
());
verify
(
teamDao
).
update
(
team
);
}
@Test
public
void
removeHomeGameGameIsNull
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
assertThatExceptionOfType
(
NullPointerException
.
class
).
isThrownBy
(
()
->
teamService
.
addHomeGame
(
team
,
null
)
);
assertThat
(
team
.
getHomeGames
()).
hasSameElementsAs
(
List
.
of
());
}
@Test
public
void
removeHomeGameTeamIsNull
()
{
Game
game
=
buildGame
();
assertThatExceptionOfType
(
NullPointerException
.
class
).
isThrownBy
(
()
->
teamService
.
addHomeGame
(
null
,
game
)
);
}
private
Game
buildGame
()
{
var
game
=
new
Game
();
game
.
setId
(
1L
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment