Replaced wrong assert lib with static org.junit.Assert.

This commit is contained in:
Tom Vahlman 2012-02-21 11:53:56 +01:00
parent 8eed555335
commit 7de1c5e60d

@ -8,7 +8,6 @@ import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import se.su.dsv.scipro.data.dao.interfaces.LanguageDao;
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
@ -24,6 +23,7 @@ import se.su.dsv.scipro.match.dataobject.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import se.su.dsv.scipro.match.facade.ApplicationPeriodFacade;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@ -163,10 +163,10 @@ public class TestGreedyMatchingAlgorithm {
supervisorAvailability.add(new Availability(supervisor, 0L, 1, projectClass));
unmatchedProjectIdeas.add(projectIdea);
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.notEmpty(result.matches);
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(projectIdea));
Assert.isTrue(result.matches.get(0).getSupervisor().equals(supervisor));
Assert.isTrue(result.unmatched.size() == 0);
assertFalse(result.matches.size() == 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(projectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(supervisor));
assertTrue(result.unmatched.size() == 0);
}
@ -179,8 +179,8 @@ public class TestGreedyMatchingAlgorithm {
unmatchedProjectIdeas.add(masterProjectIdea);
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.isTrue(result.matches.size() == 0);
Assert.isTrue(result.unmatched.size() == 1);
assertTrue(result.matches.size() == 0);
assertTrue(result.unmatched.size() == 1);
}
@Test
@ -192,8 +192,8 @@ public class TestGreedyMatchingAlgorithm {
addRejectedMatch(bachelorSupervisor, bachelorProjectIdea);
unmatchedProjectIdeas.add(bachelorProjectIdea);
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.isTrue(result.matches.size() == 0);
Assert.isTrue(result.unmatched.size() == 1);
assertTrue(result.matches.size() == 0);
assertTrue(result.unmatched.size() == 1);
}
@ -216,8 +216,8 @@ public class TestGreedyMatchingAlgorithm {
addRejectedMatch(masterSupervisor, bachelorProjectIdea);
unmatchedProjectIdeas.add(bachelorProjectIdea);
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.isTrue(result.matches.size() == 0);
Assert.isTrue(result.unmatched.size() == 1);
assertTrue(result.matches.size() == 0);
assertTrue(result.unmatched.size() == 1);
}
@Test
@ -231,9 +231,9 @@ public class TestGreedyMatchingAlgorithm {
addRejectedMatch(bachelorSupervisor2, 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));
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
}
@Test
@ -247,10 +247,10 @@ public class TestGreedyMatchingAlgorithm {
bachelorProjectIdea.setPreferredSupervisor(bachelorSupervisor2);
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
assertTrue(result.unmatched.size() == 0);
}
@ -265,10 +265,10 @@ public class TestGreedyMatchingAlgorithm {
masterProjectIdea.setPreferredSupervisor(bachelorSupervisor2);
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(masterProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(masterSupervisor));
assertTrue(result.unmatched.size() == 0);
}
private void addKeyWords(final Employee supervisor, final ProjectIdea projectIdea, final Keyword keyword) {
@ -298,10 +298,10 @@ public class TestGreedyMatchingAlgorithm {
bachelorProjectIdea.setPreferredSupervisor(bachelorSupervisor); // 15
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
assertTrue(result.unmatched.size() == 0);
}
@Test
@ -317,10 +317,10 @@ public class TestGreedyMatchingAlgorithm {
bachelorProjectIdea.setPreferredSupervisor(bachelorSupervisor); // 15
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
assertTrue(result.unmatched.size() == 0);
}
@Test
@ -336,10 +336,10 @@ public class TestGreedyMatchingAlgorithm {
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor2));
assertTrue(result.unmatched.size() == 0);
}
@Test
@ -355,10 +355,10 @@ public class TestGreedyMatchingAlgorithm {
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
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));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
assertTrue(result.unmatched.size() == 0);
}
@Test
@ -383,10 +383,10 @@ public class TestGreedyMatchingAlgorithm {
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
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_sv));
Assert.isTrue(result.unmatched.size() == 0);
assertTrue(result.matches.size() > 0);
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor_sv));
assertTrue(result.unmatched.size() == 0);
}
@Test
@ -401,11 +401,11 @@ public class TestGreedyMatchingAlgorithm {
supervisorAvailability.add(new Availability(bachelorSupervisor, 0L, 1, bachelorProjectClass));
unmatchedProjectIdeas.add(bachelorProjectIdea);
Result result = new GreedyMatchingAlgorithm().match(supervisorAvailability, unmatchedProjectIdeas, weights);
Assert.notEmpty(result.matches);
assertTrue(result.matches.size() > 0);
//Assert.isTrue(result.matches.size() == 2); // WHY DOES THIS TEST BREAK?????
Assert.isTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
Assert.isTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
Assert.isTrue(result.unmatched.size() == 0);
//isTrue(result.matches.size() == 2); // WHY DOES THIS TEST BREAK?????
assertTrue(result.matches.get(0).getProjectIdea().equals(bachelorProjectIdea));
assertTrue(result.matches.get(0).getSupervisor().equals(bachelorSupervisor));
assertTrue(result.unmatched.size() == 0);
}
}