@Test public void getFormattedDegrees_DecimalDegrees_ReturnsDD(){ double lat = 51.2828223838d; String expected = "51" + getDecimalSeparator() + "282822"; PreferenceHelper ph = mock(PreferenceHelper.class); when(ph.getDisplayLatLongFormat()).thenReturn(PreferenceNames.DegreesDisplayFormat.DECIMAL_DEGREES); String actual = Strings.getFormattedDegrees(lat, true, ph); assertThat("Preference DD returns DD", actual, is(expected)); }
static String getFormattedDegrees(double decimaldegrees, boolean isLatitude, PreferenceHelper ph){ switch(ph.getDisplayLatLongFormat()){ case DEGREES_MINUTES_SECONDS: return getDegreesMinutesSeconds(decimaldegrees, isLatitude); case DEGREES_DECIMAL_MINUTES: return getDegreesDecimalMinutes(decimaldegrees, isLatitude); case DECIMAL_DEGREES: default: return getDecimalDegrees(decimaldegrees); } }
Strings { static String getFormattedDegrees(double decimaldegrees, boolean isLatitude, PreferenceHelper ph){ switch(ph.getDisplayLatLongFormat()){ case DEGREES_MINUTES_SECONDS: return getDegreesMinutesSeconds(decimaldegrees, isLatitude); case DEGREES_DECIMAL_MINUTES: return getDegreesDecimalMinutes(decimaldegrees, isLatitude); case DECIMAL_DEGREES: default: return getDecimalDegrees(decimaldegrees); } } }
Strings { static String getFormattedDegrees(double decimaldegrees, boolean isLatitude, PreferenceHelper ph){ switch(ph.getDisplayLatLongFormat()){ case DEGREES_MINUTES_SECONDS: return getDegreesMinutesSeconds(decimaldegrees, isLatitude); case DEGREES_DECIMAL_MINUTES: return getDegreesDecimalMinutes(decimaldegrees, isLatitude); case DECIMAL_DEGREES: default: return getDecimalDegrees(decimaldegrees); } }  }
Strings { static String getFormattedDegrees(double decimaldegrees, boolean isLatitude, PreferenceHelper ph){ switch(ph.getDisplayLatLongFormat()){ case DEGREES_MINUTES_SECONDS: return getDegreesMinutesSeconds(decimaldegrees, isLatitude); case DEGREES_DECIMAL_MINUTES: return getDegreesDecimalMinutes(decimaldegrees, isLatitude); case DECIMAL_DEGREES: default: return getDecimalDegrees(decimaldegrees); } }  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); }
Strings { static String getFormattedDegrees(double decimaldegrees, boolean isLatitude, PreferenceHelper ph){ switch(ph.getDisplayLatLongFormat()){ case DEGREES_MINUTES_SECONDS: return getDegreesMinutesSeconds(decimaldegrees, isLatitude); case DEGREES_DECIMAL_MINUTES: return getDegreesDecimalMinutes(decimaldegrees, isLatitude); case DECIMAL_DEGREES: default: return getDecimalDegrees(decimaldegrees); } }  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);  }