A comparison should be based on equals and not the "=="-operator.

This commit is contained in:
Tom Vahlman 2012-02-11 16:15:39 +01:00
parent 4a03a2400d
commit 29d42cdb2d

@ -72,7 +72,8 @@ public class TestGreedyMatchingAlgorithm {
bachelorSupervisor = new Employee();
User user1 = new User();
user1.setFirstName("User 1");
user1.setFirstName("Henrik");
user1.setLastName("Hansson");
user1 = userDao.save(user1);
bachelorSupervisor.getCapabilities().setLanguages(languages);
bachelorSupervisor.setUser(user1);
@ -80,7 +81,8 @@ public class TestGreedyMatchingAlgorithm {
masterSupervisor = new Employee();
User user2 = new User();
user2.setFirstName("User 2");
user2.setFirstName("Birger");
user2.setLastName("Andersson");
user2 = userDao.save(user2);
masterSupervisor.getCapabilities().setLanguages(languages);
masterSupervisor.setUser(user2);
@ -113,7 +115,6 @@ public class TestGreedyMatchingAlgorithm {
@Rollback
public void testMatchMasterThesisAndMasterSupervisor() {
Availability availability = new Availability(masterSupervisor, 0L, 1, masterProjectClass);
supervisorAvailability.add(availability);
unmatchedProjectIdeas.add(masterProjectIdea);
@ -137,10 +138,10 @@ public class TestGreedyMatchingAlgorithm {
GreedyMatchingAlgorithm matchAlgorithm = new GreedyMatchingAlgorithm();
Result result = matchAlgorithm.match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.isTrue(result.matches.get(0).getProjectIdea() == bachelorProjectIdea);
Assert.isTrue(result.matches.get(0).getSupervisor() == masterSupervisor);
Assert.notEmpty(result.matches);
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
Assert.isTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
Assert.isTrue(result.unmatched.size() == 0);
}
@ -154,10 +155,9 @@ public class TestGreedyMatchingAlgorithm {
GreedyMatchingAlgorithm matchAlgorithm = new GreedyMatchingAlgorithm();
Result result = matchAlgorithm.match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.isTrue(result.matches.get(0).getProjectIdea() == bachelorProjectIdea);
Assert.isTrue(result.matches.get(0).getSupervisor() == bachelorSupervisor);
Assert.notEmpty(result.matches);
Assert.notEmpty(result.matches);
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
Assert.isTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
Assert.isTrue(result.unmatched.size() == 0);
}