### Question:
GpsNode extends SerialNode { protected Date convertHHMMSStoTime(String timeHHMMSSss) { DateFormat f = new SimpleDateFormat("HHmmss"); try { return f.parse(timeHHMMSSss); } catch (ParseException e) { new RobobuggyLogicNotification("Couldn't parse a time we got from peel!", RobobuggyMessageLevel.WARNING); return new Date(); } } GpsNode(NodeChannel sensor, String portName); @Override boolean matchDataSample(byte[] sample); @Override int matchDataMinSize(); @Override int getBaudRate(); @Override int peel(byte[] buffer, int start, int bytesAvailable);  }### Answer:
@Test public void testConversionDateTime(){ GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "123519"; Date d1 = gpsNode1.convertHHMMSStoTime(input); assertEquals(d1.getHours(),12); assertEquals(d1.getMinutes(),35); assertEquals(d1.getSeconds(),19); }
@Test public void testBadConversionDateTime(){ GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "123L19"; try { Date d1 = gpsNode1.convertHHMMSStoTime(input); fail("could not convert the time"); } catch (AssertionError e){ return; } }