### Question:
Strings { public static String getDegreesMinutesSeconds(double decimaldegrees, boolean isLatitude) { String cardinality = (decimaldegrees<0) ? "S":"N"; if(!isLatitude){ cardinality = (decimaldegrees<0) ? "W":"E"; } decimaldegrees = Math.abs(decimaldegrees); int deg = (int) Math.floor(decimaldegrees); double minfloat = (decimaldegrees-deg)*60; int min = (int) Math.floor(minfloat); double secfloat = (minfloat-min)*60; double sec = Math.round(secfloat * 10000.0)/10000.0; if (sec==60) { min++; sec=0; } if (min==60) { deg++; min=0; } return ("" + deg + "° " + min + "' " + sec + "\" " + cardinality); }  static String getDescriptiveDurationString(int numberOfSeconds,
                                                      Context context); static String getBearingDescription(float bearingDegrees,
                                               Context context); static String cleanDescriptionForXml(String desc); static String cleanDescriptionForJson(String desc); static String getIsoDateTime(Date dateToFormat); static String getIsoDateTimeFormat(); static String getIsoCalendarDate(Date dateToFormat); static String getIsoCalendarDateFormat(); static String getReadableDateTime(Date dateToFormat); static boolean isNullOrEmpty(String text); static String htmlDecode(String text); static String getBuildSerial(); static String getFormattedFileName(); static String getFormattedFileName(Session session, PreferenceHelper ph); static String getFormattedCustomFileName(String baseName, Calendar calendar, PreferenceHelper ph); static int toInt(String number, int defaultVal); static String getSpeedDisplay(Context context, double metersPerSecond, boolean imperial); static String getDistanceDisplay(Context context, double meters, boolean imperial, boolean autoscale); static String getTimeDisplay(Context context, long milliseconds); static Map<String, String> getAvailableLocales(Context context); static String getSanitizedMarkdownForFaqView(String md); static String getDegreesMinutesSeconds(double decimaldegrees, boolean isLatitude); static String getDegreesDecimalMinutes(double decimaldegrees, boolean isLatitude); static String getDecimalDegrees(double decimaldegrees); static String getFormattedLatitude(double decimaldegrees); static String getFormattedLongitude(double decimaldegrees); static String getDetectedActivityName(DetectedActivity detectedActivity);  }### Answer:
@Test public void getDegreesMinutesSeconds_BasicConversion(){ double lat = 11.812244d; String expected = "11° 48' 44.0784\" N"; String actual = Strings.getDegreesMinutesSeconds(lat, true); assertThat("Degree Decimals converted to Degree Minute Seconds", actual, is(expected)); }
@Test public void getDegreesMinutesSeconds_NegativeIsSouth(){ double lat = -16.44299d; String expected = "16° 26' 34.764\" S"; String actual = Strings.getDegreesMinutesSeconds(lat, true); assertThat("Negative degree decimals converted to southerly degree minute second", actual, is(expected)); }
@Test public void getDegreesMinutesSeconds_Longitude_ReturnsEastWest(){ double lon = 17.072754d; String expected = "17° 4' 21.9144\" E"; String actual = Strings.getDegreesMinutesSeconds(lon, false); assertThat("Longitude values have east west cardinality", actual, is(expected)); lon = -137.072754; expected = "137° 4' 21.9144\" W"; actual = Strings.getDegreesMinutesSeconds(lon, false); assertThat("Longitude values have east west cardinality", actual, is(expected)); }