Refactoring of tests.
This commit is contained in:
parent
efdc62dc98
commit
dbdb9cb34b
@ -112,11 +112,6 @@ public class TestGreedyMatchingAlgorithm {
|
||||
masterProjectIdea = createProjectIdea(masterProjectClass);
|
||||
createWeights();
|
||||
}
|
||||
|
||||
private Result runAlgorithm(final ProjectIdea projectIdea) {
|
||||
unmatchedProjectIdeas.add(projectIdea);
|
||||
return new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@ -124,7 +119,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
/* Make a match based on language, project class and if the supervisor has rejected the project idea previously or not */
|
||||
public void testMatchMasterThesisAndMasterSupervisor() {
|
||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, masterProjectClass));
|
||||
Result result = runAlgorithm(masterProjectIdea);
|
||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
|
||||
@ -136,7 +132,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
@Rollback
|
||||
public void testMatchBachelorThesisAndMasterSupervisor() {
|
||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, masterProjectClass));
|
||||
Result result = runAlgorithm(bachelorProjectIdea);
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
|
||||
@ -148,7 +145,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
@Rollback
|
||||
public void testMatchBachelorThesisAndBachelorSupervisor() {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
Result result = runAlgorithm(bachelorProjectIdea);
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
|
||||
@ -161,7 +159,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
/* no matches are found */
|
||||
public void testMatchMasterThesisAndBachelorSupervisor() {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
Result result = runAlgorithm(masterProjectIdea);
|
||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.unmatched);
|
||||
Assert.isTrue(result.matches.size() == 0);
|
||||
}
|
||||
@ -174,8 +173,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
||||
bachelorProjectIdea.setPreferredSupervisor(bachelorSupervisor2);
|
||||
|
||||
Result result = runAlgorithm(bachelorProjectIdea);
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.matches);
|
||||
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
|
||||
|
Loading…
x
Reference in New Issue
Block a user