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
f52089b9
Commit
f52089b9
authored
Mar 27, 2022
by
Milan Mozolák
Browse files
Added report agent assignent test
parent
e273b10e
Pipeline
#123075
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 @
f52089b9
...
...
@@ -31,6 +31,7 @@ public class AgentAssignment {
@OneToOne
@JoinColumn
(
name
=
"report_id"
)
@Setter
(
AccessLevel
.
NONE
)
private
Report
report
;
@ManyToOne
...
...
@@ -44,6 +45,11 @@ public class AgentAssignment {
@Setter
(
AccessLevel
.
NONE
)
private
Set
<
PerformanceEvaluation
>
performanceEvaluations
=
new
HashSet
<>();
public
void
setReport
(
Report
report
)
{
this
.
report
=
report
;
report
.
setAgentAssignment
(
this
);
}
public
void
addPerformanceEvaluation
(
PerformanceEvaluation
performanceEvaluation
)
{
performanceEvaluations
.
add
(
performanceEvaluation
);
}
...
...
src/test/java/cz/fi/muni/pa165/seminar4/group7/secretservice/dao/ReportDaoTests.java
View file @
f52089b9
package
cz.fi.muni.pa165.seminar4.group7.secretservice.dao
;
import
cz.fi.muni.pa165.seminar4.group7.secretservice.entity.AgentAssignment
;
import
cz.fi.muni.pa165.seminar4.group7.secretservice.entity.Report
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
...
...
@@ -105,4 +106,16 @@ class ReportDaoTests {
assertEquals
(
report
.
getId
(),
report2
.
get
().
getId
());
assertThat
(
reportDao
.
findAll
()).
hasSize
(
1
);
}
@Test
void
agentAssignment
()
{
var
assignment
=
new
AgentAssignment
();
var
report
=
createNewReport
();
assignment
.
setReport
(
report
);
reportDao
.
save
(
report
);
var
report2
=
reportDao
.
findById
(
report
.
getId
());
assertThat
(
report2
).
isPresent
();
assertEquals
(
assignment
,
report2
.
get
().
getAgentAssignment
());
}
}
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