Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Smejkal
Pa165 Secret Archive
Commits
fdb7c53e
Commit
fdb7c53e
authored
Mar 27, 2022
by
tbilos
Browse files
fix test
parent
c8cbaccc
Pipeline
#123227
waiting for manual action with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/AgentAssignment.java
View file @
fdb7c53e
...
...
@@ -38,7 +38,7 @@ public class AgentAssignment extends BaseEntity {
@ManyToOne
private
Agent
agent
;
@OneToMany
@OneToMany
(
cascade
=
CascadeType
.
ALL
)
@Setter
(
AccessLevel
.
NONE
)
private
Set
<
PerformanceEvaluation
>
performanceEvaluations
=
new
HashSet
<>();
...
...
src/test/java/cz/fi/muni/pa165/seminar4/group7/secretservice/dao/AgentAssignmentDaoTest.java
View file @
fdb7c53e
...
...
@@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
javax.transaction.Transactional
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.*;
/**
...
...
@@ -46,6 +48,7 @@ public class AgentAssignmentDaoTest {
}
@Test
@Transactional
public
void
addPerformanceEvaluation
()
{
var
agentAssignment
=
new
AgentAssignment
();
agentAssignment
.
addPerformanceEvaluation
(
new
PerformanceEvaluation
());
...
...
@@ -57,15 +60,18 @@ public class AgentAssignmentDaoTest {
}
@Test
@Transactional
public
void
removePerformanceEvaluation
()
{
var
agentAssignment
=
new
AgentAssignment
();
var
perfEval
=
new
PerformanceEvaluation
();
agentAssignment
.
addPerformanceEvaluation
(
new
PerformanceEvaluation
()
);
agentAssignment
.
addPerformanceEvaluation
(
perfEval
);
agentAssignmentDao
.
save
(
agentAssignment
);
agentAssignment
.
removePerformanceEvaluation
(
perfEval
);
agentAssignmentDao
.
save
(
agentAssignment
);
var
agentAssignment2
=
agentAssignmentDao
.
findById
(
agentAssignment
.
getId
());
assertThat
(
agentAssignment2
).
isPresent
();
assertThat
(
agentAssignment2
.
get
().
getPerformanceEvaluations
()).
isEmpty
(
);
assertThat
(
agentAssignment2
.
get
().
getPerformanceEvaluations
()).
hasSize
(
0
);
}
}
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