コード例 #1
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
  @BeforeClass
  public static void insertTeam() {
    ScrumzuUser user = new ScrumzuUser("TestUser", "Hash password", true);
    insertedUser = user;

    Calendar calendar = Calendar.getInstance();
    calendar.set(2012, 01, 01);

    Project project = new Project();
    project.setAlias("XX");
    project.setDescription("To jest test do JUnit");
    project.setName("Projekt Testowy");
    project.setOwner("Kowalski Jarosław");
    project.setUrl("http://com.pl");
    project.setVersion("1.23");
    insertedProject = project;

    Team team = new Team();
    team.setAlias("ZZ");
    team.setDescription("To jest test do JUnit");
    team.setName("Test Testowy");
    team.setProject(insertedProject);
    team.setUser(insertedUser);
    insertedTeam = team;

    Sprint sprint = new Sprint();
    sprint.setDateFrom(Calendar.getInstance().getTime());
    sprint.setDateTo(calendar.getTime());
    sprint.setSprintStatus(SprintStatus.CREATED);
    sprint.setName("pierwszy");
    sprint.setProject(insertedProject);
    insertedSprint = sprint;

    PBI pbi = new PBI();
    pbi.setDateCreation(Calendar.getInstance().getTime());
    pbi.setDescription("To jest PBI testowe JUnit");
    pbi.setPriority(1);
    pbi.setProject(insertedProject);
    pbi.setTitle("Testowe PBI");
    pbi.setType(Type.PERFORMANCE);
    insertedPBI = pbi;

    WorkItem workItem = new WorkItem();
    workItem.setStatus(Status.DONE);
    workItem.setPbi(insertedPBI);
    workItem.setSprint(insertedSprint);
    workItem.setTeam(insertedTeam);
    workItem.setUser(insertedUser);
    workItem.setDateForNow();
    insertedWorkItem = workItem;
  }
コード例 #2
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @Test
 public void deleteWithWorkItemsTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   pbiDao.save(insertedPBI);
   sprintDao.save(insertedSprint);
   teamDao.save(insertedTeam);
   workItemDao.save(insertedWorkItem);
   insertedTeam.addWorkItem(insertedWorkItem);
   insertedWorkItem.setTeam(insertedTeam);
   teamDao.flushSession();
   long idTeam = insertedTeam.getIdTeam();
   teamDao.delete(insertedTeam);
   teamDao.flushSession();
   int counter =
       super.simpleJdbcTemplate.queryForInt(
           "select count(*) from Teams where idTeam=?", new Object[] {idTeam});
   assertEquals("JDBC query must return no teams with this id", 0, counter);
   counter =
       super.simpleJdbcTemplate.queryForInt(
           "select count(*) from WorkItems where idTeam=?", new Object[] {idTeam});
   assertEquals("JDBC query must return no workItems with this id", 0, counter);
 }