Test that the number Availability#numMatched has increased with one and that the supervisor with highest available slots are chosen.
This commit is contained in:
parent
4549370ea0
commit
380822ed8d
@ -455,6 +455,43 @@ public class TestGreedyMatchingAlgorithm {
|
||||
assertTrue(result.unmatched.size() == 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
/* test that the number Availability#numMatched has increased with one and that the supervisor with highest available slots are chosen */
|
||||
public void testNumMatchedHasIncreased() {
|
||||
Employee bachelorSupervisor2 = createSupervisor("David", "Hallberg", languages);
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 4, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
|
||||
boolean found = false;
|
||||
for(Availability availability : supervisorAvailability) {
|
||||
if(availability.getSupervisor().equals(bachelorSupervisor2)) {
|
||||
assertTrue(availability.getNumMatched() == 0);
|
||||
assertTrue(availability.getNumCapable() == 4);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
assertTrue(result.matches.size() > 0);
|
||||
|
||||
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
||||
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
||||
found = false;
|
||||
for(Availability availability : supervisorAvailability) {
|
||||
if(availability.getSupervisor().equals(bachelorSupervisor2)) {
|
||||
assertTrue(availability.getNumMatched() == 1);
|
||||
assertTrue(availability.getNumCapable() == 4);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
assertTrue(result.unmatched.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
|
Loading…
x
Reference in New Issue
Block a user