Ejemplo n.º 1
0
  @Test
  public void testGet() {
    // get retrospective
    RetrospectiveObject retrospective = RetrospectiveDAO.getInstance().get(mRtrospectiveId);

    // assert
    assertNotNull(retrospective);
    assertEquals("TEST_RETROSPECTIVE_NAME", retrospective.getName());
    assertEquals("TEST_RETROSPECTIVE_DESCRIPTION", retrospective.getDescription());
    assertEquals(RetrospectiveObject.TYPE_GOOD, retrospective.getType());
    assertEquals(RetrospectiveObject.STATUS_NEW, retrospective.getStatus());
  }
Ejemplo n.º 2
0
  @Test
  public void testCreate() throws SQLException {
    // Test data
    String name = "TEST_RETROSPECTIVE_NAME";
    String description = "TEST_RETROSPECTIVE_DESCRIPTION";
    String type = RetrospectiveObject.TYPE_GOOD;
    String status = RetrospectiveObject.STATUS_NEW;
    long sprintId = 1;

    // Create Retrospective
    RetrospectiveObject retrospective = new RetrospectiveObject(mProject.getId());
    retrospective
        .setName(name)
        .setDescription(description)
        .setType(type)
        .setStatus(status)
        .setSprintId(sprintId);

    // Test create method
    long retrospectiveId = RetrospectiveDAO.getInstance().create(retrospective);
    assertTrue(retrospectiveId > 0);

    // Get Data From DB
    IQueryValueSet valueSet = new MySQLQuerySet();
    valueSet.addTableName(RetrospectiveEnum.TABLE_NAME);
    valueSet.addEqualCondition(RetrospectiveEnum.ID, retrospectiveId);

    String query = valueSet.getSelectQuery();
    ResultSet result = mControl.executeQuery(query);

    RetrospectiveObject retrospectiveFromDB = null;

    if (result.next()) {
      retrospectiveFromDB = RetrospectiveDAO.convert(result);
    }
    closeResultSet(result);

    // Verify Data
    assertEquals(name, retrospectiveFromDB.getName());
    assertEquals(description, retrospectiveFromDB.getDescription());
    assertEquals(type, retrospectiveFromDB.getType());
    assertEquals(status, retrospectiveFromDB.getStatus());
    assertEquals(sprintId, retrospectiveFromDB.getSprintId());
  }
Ejemplo n.º 3
0
  @Test
  public void testUpdate() {
    // Test data
    String name = "TEST_RETROSPECTIVE_NAME_UPDATE";
    String description = "TEST_RETROSPECTIVE_DESCRIPTION_UPDATE";
    String type = RetrospectiveObject.TYPE_IMPROVEMENT;
    String status = RetrospectiveObject.STATUS_CLOSED;

    // Get retrospective
    RetrospectiveObject retrospective = RetrospectiveDAO.getInstance().get(mRtrospectiveId);
    retrospective.setName(name).setDescription(description).setType(type).setStatus(status);

    // Test update method
    boolean isUpdateSuccess = RetrospectiveDAO.getInstance().update(retrospective);
    assertTrue(isUpdateSuccess);

    RetrospectiveObject retrospectiveFromDB = RetrospectiveDAO.getInstance().get(mRtrospectiveId);
    // Verify
    assertEquals(name, retrospectiveFromDB.getName());
    assertEquals(description, retrospectiveFromDB.getDescription());
    assertEquals(type, retrospectiveFromDB.getType());
    assertEquals(status, retrospectiveFromDB.getStatus());
  }