### Question:
LongitudeFormatter extends BaseLocationFormatter { @Override public Object formatCell(String val, String fmtString) throws ParseException { if (val == null || val.isEmpty()) { return null; } CoordFormat fmt = CoordFormat.fromString(fmtString); double longitude = LatLonAltParser.parseLon(val, fmt); if (Double.isNaN(longitude)) { return Constants.ERROR_LABEL; } if (fmt == CoordFormat.DECIMAL) { return String.valueOf(longitude); } if (fmt == CoordFormat.DDM) { return LatLonAlt.lonToDdmString(longitude, 3); } return DegreesMinutesSeconds.getShortLabelString(longitude, 16, 3, 'E', 'W'); } LongitudeFormatter(PreferencesRegistry registry); @Override Object formatCell(String val, String fmtString); @Override String getFormat(List<String> values);  }### Answer:
@Test public void testFormatCell() throws ParseException { LongitudeFormatter formatter = new LongitudeFormatter(null); String decimalLongitude = "-105.39274694444445"; String longitude = (String)formatter.formatCell(decimalLongitude, "Decimal"); assertEquals(decimalLongitude, longitude); longitude = (String)formatter.formatCell("W1052333.889", CoordFormat.DMS.toString()); assertEquals(" 105°23'33.889\"W", longitude); assertNull(formatter.formatCell(null, CoordFormat.DMS.toString())); }