public void testGetLastRecordSingle() throws ParseException { Team team = testBasicData.getTeamById(1); int userId1 = 10001; testBasicData.setUserId(userId1); Date recordDateTime1 = TestUtils.parseFullDate("20120516162030.500"); TeamResult teamLevelPoint = TestUtils.createTeamLevelPoint( team, "КП1,КП2,КП3", DateFormat.parse("201205161400"), recordDateTime1); scanPointRecords.put(teamLevelPoint); int userId2 = 10002; testBasicData.setUserId(userId2); Date recordDateTime2 = TestUtils.parseFullDate("20120516162500.111"); teamLevelPoint = TestUtils.createTeamLevelPoint( team, "КП1,КП3,КП4,КП5", DateFormat.parse("201205161305"), recordDateTime2); scanPointRecords.put(teamLevelPoint); ScanPointRecord teamRecord = scanPointRecords.getLastRecord(); assertNotNull(teamRecord); assertEquals(1, teamRecord.size()); List<TeamResult> teamLevelPoints = teamRecord.getTeamResults(); assertNotNull(teamLevelPoints); assertEquals(1, teamLevelPoints.size()); teamLevelPoint = teamLevelPoints.get(0); assertEquals(recordDateTime2, teamLevelPoint.getRecordDateTime()); assertEquals(4, teamLevelPoint.getTakenCheckpoints().size()); assertEquals(DateFormat.parse("201205161305"), teamLevelPoint.getCheckDateTime()); }
private void checkRecordForUser( int userId, Date recordDateTime, String checkDateString, int takenSize, boolean checkRecordSingle) { ScanPointRecord teamRecord = scanPointRecords.getByDate(recordDateTime); assertNotNull(teamRecord); if (checkRecordSingle) assertEquals(1, teamRecord.size()); TeamResult teamLevelPoint = teamRecord.getByUserId(userId); assertEquals(takenSize, teamLevelPoint.getTakenCheckpoints().size()); assertEquals(DateFormat.parse(checkDateString), teamLevelPoint.getCheckDateTime()); }
public void testAddLevelPointRecord() 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()); ScanPointRecord teamRecord = scanPointRecords.getByDate(recordDateTime); assertNotNull(teamRecord); assertEquals(1, teamRecord.size()); teamLevelPoint = teamRecord.getByUserId(userId); assertNotNull(teamLevelPoint); assertEquals(3, teamLevelPoint.getTakenCheckpoints().size()); assertEquals(DateFormat.parse("201205161400"), teamLevelPoint.getCheckDateTime()); }
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()); }