コード例 #1
0
ファイル: ScanPointRecordsTest.java プロジェクト: se-ti/mmb
  public void testAddLevelPointRecordTwice() throws ParseException {
    Team team = testBasicData.getTeamById(1);
    Date recordDateTime = TestUtils.parseFullDate("20120516162030.500");
    TeamResult teamLevelPoint =
        TestUtils.createTeamLevelPoint(
            team, "КП1,КП2,КП3", DateFormat.parse("201205161400"), recordDateTime);
    Integer userId = teamLevelPoint.getUserId();

    scanPointRecords.put(teamLevelPoint);
    assertEquals(1, scanPointRecords.getRecordDates().size());
    assertNotNull(scanPointRecords.getDateForUser(userId));
    assertEquals(recordDateTime, scanPointRecords.getDateForUser(userId));

    recordDateTime = TestUtils.parseFullDate("20120516162500.111");
    teamLevelPoint =
        TestUtils.createTeamLevelPoint(
            team, "КП1,КП3,КП4", DateFormat.parse("201205161305"), recordDateTime);
    scanPointRecords.put(teamLevelPoint);

    assertEquals(1, scanPointRecords.getRecordDates().size());
    assertNotNull(scanPointRecords.getDateForUser(userId));
    assertEquals(
        TestUtils.parseFullDate("20120516162500.111"), scanPointRecords.getDateForUser(userId));

    ScanPointRecord teamRecord = scanPointRecords.getByDate(recordDateTime);
    assertNotNull(teamRecord);
    assertEquals(1, teamRecord.size());

    teamLevelPoint = teamRecord.getByUserId(userId);
    assertNotNull(teamLevelPoint);
    assertEquals(3, teamLevelPoint.getTakenCheckpoints().size());
    assertTrue(teamLevelPoint.getTakenCheckpointNames().contains("КП4"));
    assertFalse(teamLevelPoint.getTakenCheckpointNames().contains("КП2"));
    assertEquals(DateFormat.parse("201205161305"), teamLevelPoint.getCheckDateTime());
  }
コード例 #2
0
ファイル: ScanPointRecordsTest.java プロジェクト: se-ti/mmb
 private void checkRecord(TeamResult record, int userId, String checkDateString, int takenSize) {
   assertNotNull(record);
   assertEquals(userId, record.getUserId());
   assertEquals(takenSize, record.getTakenCheckpoints().size());
   assertEquals(DateFormat.parse(checkDateString), record.getCheckDateTime());
 }