Simplifying the name of the tests....
This commit is contained in:
parent
dbdb9cb34b
commit
122c732838
@ -98,8 +98,10 @@ public class TestGreedyMatchingAlgorithm {
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
unmatchedProjectIdeas = new ArrayList<ProjectIdea>();
|
||||
supervisorAvailability = new ArrayList<Availability>();
|
||||
unmatchedProjectIdeas = new ArrayList<ProjectIdea>();
|
||||
createWeights();
|
||||
//ProjectClass projectClass = projectClassDao.getProjectClass(ProjectClass.BACHELOR); // return NULL, the database is empty at the beginning of every test...
|
||||
languages = new HashSet<Language>();
|
||||
addLanguage("Swedish");
|
||||
addLanguage("English");
|
||||
@ -110,14 +112,14 @@ public class TestGreedyMatchingAlgorithm {
|
||||
masterSupervisor = createSupervisor("Birger", "Andersson");
|
||||
masterProjectClass = createProjectClass(ProjectClass.MASTER, "Master", "Master project class");
|
||||
masterProjectIdea = createProjectIdea(masterProjectClass);
|
||||
createWeights();
|
||||
}
|
||||
|
||||
@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() {
|
||||
/* Make a match based on language, project class, if the supervisor has rejected the project idea previously or not,
|
||||
* and if it is a masterSupervisor (that can also handle bachelorProjectIdeas) or not */
|
||||
public void match_MasterProjectIdea_And_MasterSupervisor() {
|
||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, masterProjectClass));
|
||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
@ -130,7 +132,8 @@ public class TestGreedyMatchingAlgorithm {
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testMatchBachelorThesisAndMasterSupervisor() {
|
||||
/* a masterSupervisor can also handle bachelorProjectIdeas */
|
||||
public void match_BachelorProjectIdea_And_MasterSupervisor() {
|
||||
supervisorAvailability.add(new Availability(masterSupervisor, 0L, 1, masterProjectClass));
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
@ -139,11 +142,24 @@ public class TestGreedyMatchingAlgorithm {
|
||||
Assert.isTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
|
||||
Assert.isTrue(result.unmatched.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
/* no matches are found, a bachelorSupervisor cannot handle masterProjectIdeas */
|
||||
public void match_MasterProjectIdea_And_BachelorSupervisor() {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.unmatched);
|
||||
Assert.isTrue(result.matches.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testMatchBachelorThesisAndBachelorSupervisor() {
|
||||
public void match_BachelorProjectIdea_And_BachelorSupervisor() {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
unmatchedProjectIdeas.add(bachelorProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
@ -153,22 +169,12 @@ public class TestGreedyMatchingAlgorithm {
|
||||
Assert.isTrue(result.unmatched.size() == 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
/* no matches are found */
|
||||
public void testMatchMasterThesisAndBachelorSupervisor() {
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
unmatchedProjectIdeas.add(masterProjectIdea);
|
||||
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
|
||||
Assert.notEmpty(result.unmatched);
|
||||
Assert.isTrue(result.matches.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testMatchRightSupervisor() {
|
||||
public void match_Right_Supervisor() {
|
||||
Employee bachelorSupervisor2 = createSupervisor("David", "Hallberg");
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
|
||||
supervisorAvailability.add(new Availability(bachelorSupervisor2, 0L, 1, bachelorProjectClass));
|
||||
|
Loading…
x
Reference in New Issue
Block a user