### Question:
GpsNode extends SerialNode { protected double convertMinSecToFloatLongitude(String dddmmmmm) { double ddd = Double.parseDouble(dddmmmmm.substring(0, 3)); double mins = Double.parseDouble(dddmmmmm.substring(3)); return ddd + mins / 60.0; } 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 testConversionMinSecToFloatLong() { GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "01131.000"; double output = gpsNode1.convertMinSecToFloatLongitude(input); assertEquals(output,11.5167,0.001); }
@Test public void testBadConversionMinSecToFloatLong() { GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "01E31.000"; try { double output = gpsNode1.convertMinSecToFloatLongitude(input); fail("couldn't convert longitude - invalid input"); } catch (NumberFormatException e){ return; } }