tests working
This commit is contained in:
parent
2fe908f807
commit
c46dc71842
@ -13,7 +13,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.ApplicationPeriod;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
@ -40,8 +39,6 @@ public class TestProjectIdea {
|
||||
@Autowired
|
||||
private ApplicationPeriodFacade applicationPeriodFacade;
|
||||
@Autowired
|
||||
private MatchDao matchDao;
|
||||
@Autowired
|
||||
private MatchService matchService;
|
||||
|
||||
private ProjectIdea projectIdea1;
|
||||
@ -77,16 +74,16 @@ public class TestProjectIdea {
|
||||
employee1Role = (Employee) roleService.save(employee1Role);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * No matches have been saved, method should return 0.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void testCountProjectIdeaByMatchStatus1() {
|
||||
// Long l = new Long(0);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.UNMATCHED));
|
||||
// }
|
||||
/**
|
||||
* No matches have been saved, method should return 0.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testCountProjectIdeaByMatchStatus1() {
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.UNMATCHED));
|
||||
}
|
||||
|
||||
/**
|
||||
* A match with the same status as the queried one is saved before querying, method should return 1.
|
||||
@ -101,95 +98,106 @@ public class TestProjectIdea {
|
||||
match1.setCreatedBy(employee1);
|
||||
|
||||
System.out.println("ÖÖÖÖÖÖ " + matchService.count() + " XXXXXX");
|
||||
// matchService.save(match1);
|
||||
matchDao.save(match1);
|
||||
match1 = matchService.save(match1);
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
System.out.println("ÅÅÅÅÅÅ " + matchService.count() + " XXXXXX");
|
||||
|
||||
Long l = new Long(1);
|
||||
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.UNMATCHED));
|
||||
|
||||
// Assert.assertFalse(matchRepo.findAll().isEmpty());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * A match with differing status from the queried one is saved before querying, method should return 0.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void testCountProjectIdeaByMatchStatus3() {
|
||||
// Match match1 = new Match();
|
||||
// match1.setProjectIdea(projectIdea1);
|
||||
// match1.setStatus(Match.Status.UNMATCHED);
|
||||
// match1.setCreatedBy(employee1);
|
||||
// matchDao.save(match1);
|
||||
//
|
||||
// Long l = new Long(0);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.CONFIRMED));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * No matches have been saved, method should return 0.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void countProjectIdeaByMatchStatusAndProjectClass1() {
|
||||
// Long l = new Long(0);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, bachelor));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * A match with the same status and project class as the queried ones is saved before querying, method should return 1.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void countProjectIdeaByMatchStatusAndProjectClass2() {
|
||||
// Match match1 = new Match();
|
||||
// match1.setProjectIdea(projectIdea1);
|
||||
// match1.setStatus(Match.Status.UNMATCHED);
|
||||
// match1.setCreatedBy(employee1);
|
||||
// matchDao.save(match1);
|
||||
//
|
||||
// Long l = new Long(1);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, bachelor));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * A match with the project class, but differing status, from the queried one is saved before querying, method should return 0.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void countProjectIdeaByMatchStatusAndProjectClass3() {
|
||||
// Match match1 = new Match();
|
||||
// match1.setProjectIdea(projectIdea1);
|
||||
// match1.setStatus(Match.Status.UNMATCHED);
|
||||
// match1.setCreatedBy(employee1);
|
||||
// matchDao.save(match1);
|
||||
//
|
||||
// Long l = new Long(0);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.CONFIRMED, bachelor));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * A match with the same status, but differing project class, from the queried one is saved before querying, method should return 0.
|
||||
// */
|
||||
// @Test
|
||||
// @Transactional
|
||||
// @Rollback
|
||||
// public void countProjectIdeaByMatchStatusAndProjectClass4() {
|
||||
// Match match1 = new Match();
|
||||
// match1.setProjectIdea(projectIdea1);
|
||||
// match1.setStatus(Match.Status.UNMATCHED);
|
||||
// match1.setCreatedBy(employee1);
|
||||
// matchDao.save(match1);
|
||||
//
|
||||
// Long l = new Long(0);
|
||||
// Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, master));
|
||||
// }
|
||||
/**
|
||||
* A match with differing status from the queried one is saved before querying, method should return 0.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void testCountProjectIdeaByMatchStatus3() {
|
||||
Match match1 = new Match();
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
match1 = matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.CONFIRMED));
|
||||
}
|
||||
|
||||
/**
|
||||
* No matches have been saved, method should return 0.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void countProjectIdeaByMatchStatusAndProjectClass1() {
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, bachelor));
|
||||
}
|
||||
|
||||
/**
|
||||
* A match with the same status and project class as the queried ones is saved before querying, method should return 1.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void countProjectIdeaByMatchStatusAndProjectClass2() {
|
||||
Match match1 = new Match();
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(1);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, bachelor));
|
||||
}
|
||||
|
||||
/**
|
||||
* A match with the project class, but differing status, from the queried one is saved before querying, method should return 0.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void countProjectIdeaByMatchStatusAndProjectClass3() {
|
||||
Match match1 = new Match();
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.CONFIRMED, bachelor));
|
||||
}
|
||||
|
||||
/**
|
||||
* A match with the same status, but differing project class, from the queried one is saved before querying, method should return 0.
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void countProjectIdeaByMatchStatusAndProjectClass4() {
|
||||
Match match1 = new Match();
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, master));
|
||||
}
|
||||
|
||||
/**
|
||||
* The tests below are all found in the test class for the original ProjectIdeaDao, (class TestProjectIdeaDao.java)
|
||||
|
Loading…
x
Reference in New Issue
Block a user