Added a null check.
This commit is contained in:
parent
1e72ba3087
commit
b7a428a0a2
@ -104,7 +104,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
masterSupervisor = createSupervisor("Birger", "Andersson");
|
||||
masterProjectClass = createProjectClass(ProjectClass.MASTER, "Master", "Master project class");
|
||||
masterProjectIdea = createProjectIdea(masterProjectClass);
|
||||
|
||||
masterProjectIdea.setPreferredSupervisor(masterSupervisor); // to get a better score in GreedyMatchingAlgorithm#calculateScore
|
||||
|
||||
weights = new Weights();
|
||||
weights.setKeywordPoints(3);
|
||||
weights.setResearchAreaPoints(5);
|
||||
@ -114,6 +115,7 @@ public class TestGreedyMatchingAlgorithm {
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
/* Make a match based on language, project class and if the supervisor has rejected the project idea previously or not */
|
||||
public void testMatchMasterThesisAndMasterSupervisor() {
|
||||
Availability availability = new Availability(masterSupervisor, 0L, 1, masterProjectClass);
|
||||
supervisorAvailability.add(availability);
|
||||
@ -121,8 +123,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
|
||||
GreedyMatchingAlgorithm matchAlgorithm = new GreedyMatchingAlgorithm();
|
||||
Result result = matchAlgorithm.match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.unmatched.size() == 0);
|
||||
}
|
||||
|
||||
@ -168,7 +170,6 @@ public class TestGreedyMatchingAlgorithm {
|
||||
|
||||
GreedyMatchingAlgorithm matchAlgorithm = new GreedyMatchingAlgorithm();
|
||||
Result result = matchAlgorithm.match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
|
||||
Assert.notEmpty(result.unmatched);
|
||||
Assert.isTrue(result.matches.size() == 0);
|
||||
}
|
||||
@ -188,7 +189,7 @@ public class TestGreedyMatchingAlgorithm {
|
||||
|
||||
GreedyMatchingAlgorithm matchAlgorithm = new GreedyMatchingAlgorithm();
|
||||
Result result = matchAlgorithm.match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
|
||||
Assert.notEmpty(result.unmatched);
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user