Commit f52089b9 authored by Milan Mozolák's avatar Milan Mozolák
Browse files

Added report agent assignent test

parent e273b10e
Pipeline #123075 waiting for manual action with stage
......@@ -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);
}
......
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());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment