### Question:
RecordValidationServiceImpl implements RecordValidationService { @Override public boolean validateLastKnownRecord(CcAndInferredLocationRecord record) { boolean isValid = true; BigDecimal inferredLatitude = record.getInferredLatitude(); BigDecimal inferredLongitude = record.getInferredLongitude(); if((!isValueWithinRange(inferredLatitude, -999.999999, 999.999999)) || (!isValueWithinRange(inferredLongitude, -999.999999, 999.999999))) { isValid = false; } if(StringUtils.isNotBlank(record.getInferredTripId())) { if (record.getInferredTripId().length() >= 64) { log.error("Inferred trip id too long : {}", record.getVehicleId()); isValid = false; } } if(StringUtils.isNotBlank(record.getInferredBlockId())) { if (record.getInferredBlockId().length() >= 64) { log.error("Inferred block id too long : {}", record.getVehicleId()); isValid = false; } } return isValid; }  @Override boolean validateInferenceRecord(NycQueuedInferredLocationBean inferredRecord); @Override boolean validateRealTimeRecord(RealtimeEnvelope realTimeRecord); @Override boolean validateLastKnownRecord(CcAndInferredLocationRecord record); @Override boolean isValueWithinRange(Double value, double lowerBound, double upperBound); @Override boolean validateArchiveInferenceRecord(
      ArchivedInferredLocationRecord inferredRecord);  }### Answer:
@Test public void testInvalidLastKnownRecord() { CcAndInferredLocationRecord record = mock(CcAndInferredLocationRecord.class); when(record.getVehicleId()).thenReturn(4123); when(record.getInferredLatitude()).thenReturn(BigDecimal.valueOf(1D)); when(record.getInferredLongitude()).thenReturn(BigDecimal.valueOf(-1D)); when(record.getInferredTripId()).thenReturn("MTABC_5006371-CPPA4-CP_A4-Weekday-10-SDon"); when(record.getInferredBlockId()).thenReturn("MTABC_CPPA4-CP_A4-Weekday-10-SDon_E_ 450011_58800_Q66_614_orpha"); boolean valid = validationService.validateLastKnownRecord(record); assertTrue("valid record", valid); when(record.getVehicleId()).thenReturn(4123); when(record.getInferredLatitude()).thenReturn(BigDecimal.valueOf(1D)); when(record.getInferredLongitude()).thenReturn(BigDecimal.valueOf(-1D)); when(record.getInferredTripId()).thenReturn("MTABC_5006371-CPPA4-CP_A4-Weekday-10-SDon"); when(record.getInferredBlockId()).thenReturn("MTABC_CPPA4-CP_A4-Weekday-10-SDon_E_ 450011_58800_Q66_614_orphan_15390"); valid = validationService.validateLastKnownRecord(record); assertFalse("Expecting invalid record", valid); when(record.getVehicleId()).thenReturn(4123); when(record.getInferredLatitude()).thenReturn(BigDecimal.valueOf(1D)); when(record.getInferredLongitude()).thenReturn(BigDecimal.valueOf(-1D)); when(record.getInferredTripId()).thenReturn("MTABC_5006371-CPPA4-CP_A4-Weekday-10-SDon 450011_58800_Q66_614_orphan"); when(record.getInferredBlockId()).thenReturn("MTABC_CPPA4-CP_A4-Weekday-10-SDon_E_ 450011_58800_Q66_614_orpha"); valid = validationService.validateLastKnownRecord(record); assertFalse("Expecting invalid record", valid); }