### Question:
GpsNode extends SerialNode { protected double convertMinutesSecondsToFloat(String posDDMMmmmmm) { double posDD = Double.parseDouble(posDDMMmmmmm.substring(0, 2)); double posMM = Double.parseDouble(posDDMMmmmmm.substring(2)); return posDD + posMM / 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 testConversionMinSecToFloat() { GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "4807.038"; double output = gpsNode1.convertMinutesSecondsToFloat(input); assertEquals(output,48.1173,0.001); }
@Test public void testBadConversionMinSecToFloat() { GpsNode gpsNode1 = new GpsNode(NodeChannel.GPS,"buggy"); String input = "480O.038"; try { double output = gpsNode1.convertMinutesSecondsToFloat(input); fail("cannot convert given latitude"); } catch (NumberFormatException e){ return; } }