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
22419625
There was an error fetching the commit references. Please try again later.
Commit
22419625
authored
3 years ago
by
Erik Moravec
Browse files
Options
Downloads
Patches
Plain Diff
test: added tests for remove away game and createTeam
parent
59901df0
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
+59
-0
59 additions, 0 deletions
.../pa165/icehockeymanager/services/TeamServiceImplTest.java
with
59 additions
and
0 deletions
src/test/java/cz/muni/fi/pa165/icehockeymanager/services/TeamServiceImplTest.java
+
59
−
0
View file @
22419625
...
...
@@ -240,6 +240,65 @@ class TeamServiceImplTest {
assertThat
(
team
.
getHomeGames
()).
containsOnly
(
game
);
}
@Test
public
void
removeAwayGameOneOfOne
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
Game
game
=
buildGame
();
team
.
setAwayGames
(
Set
.
of
(
game
));
teamService
.
removeAwayGame
(
team
,
game
);
assertThat
(
team
.
getAwayGames
()).
isEmpty
();
verify
(
teamDao
).
update
(
team
);
}
@Test
public
void
removeAwayGameOneOfMany
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
Game
game
=
buildGame
();
game
.
setId
(
2L
);
Game
game2
=
buildGame
();
team
.
setAwayGames
(
Set
.
of
(
game
,
game2
));
teamService
.
removeAwayGame
(
team
,
game
);
assertThat
(
team
.
getAwayGames
()).
containsOnly
(
game2
);
verify
(
teamDao
).
update
(
team
);
}
@Test
public
void
removeAwayGameGameIsNull
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
assertThatExceptionOfType
(
NullPointerException
.
class
).
isThrownBy
(
()
->
teamService
.
addAwayGame
(
team
,
null
)
);
assertThat
(
team
.
getAwayGames
()).
isEmpty
();
}
@Test
public
void
removeAwayGameTeamIsNull
()
{
Game
game
=
buildGame
();
assertThatExceptionOfType
(
NullPointerException
.
class
).
isThrownBy
(
()
->
teamService
.
addAwayGame
(
null
,
game
)
);
}
@Test
public
void
removeAwayGameNotPresent
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
Game
game
=
buildGame
();
game
.
setId
(
2L
);
Game
game2
=
buildGame
();
team
.
setAwayGames
(
Set
.
of
(
game
));
assertThatExceptionOfType
(
UnknownGameException
.
class
).
isThrownBy
(
()
->
teamService
.
removeAwayGame
(
team
,
game2
)
);
assertThat
(
team
.
getAwayGames
()).
containsOnly
(
game
);
}
@Test
public
void
createTeam
()
{
Team
team
=
buildTeam
(
"Florida Panthers"
);
teamService
.
createTeam
(
team
);
verify
(
teamDao
).
create
(
team
);
}
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