NcdcRecordParser { public void parse(String record) { stationId = record.substring(4, 10) + "-" + record.substring(10, 15); observationDateString = record.substring(15, 27); year = record.substring(15, 19); airTemperatureMalformed = false; if (record.charAt(87) == '+') { airTemperatureString = record.substring(88, 92); airTemperature = Integer.parseInt(airTemperatureString); } else if (record.charAt(87) == '-') { airTemperatureString = record.substring(87, 92); airTemperature = Integer.parseInt(airTemperatureString); } else { airTemperatureMalformed = true; } airTemperature = Integer.parseInt(airTemperatureString); quality = record.substring(92, 93); }  void parse(String record); void parse(Text record); boolean isValidTemperature(); boolean isMalformedTemperature(); boolean isMissingTemperature(); String getStationId(); Date getObservationDate(); String getYear(); int getYearInt(); int getAirTemperature(); String getAirTemperatureString(); String getQuality();  }
@Test(expected=NumberFormatException.class) public void cannotParseMalformedTemperature() { parser.parse("0043011990999991950051512004+68750+023550FM-12+038299999V0203201N00671220001CN9999999N9+XXXX1+99999999999"); }