src/androidTest/java/de/dennisguse/opentracks/util/StringUtilsTest.java
private void assertGetTime(String xmlDateTime, int year, int month, int day, int hour, int minute, int second, int millisecond) {
        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        calendar.set(year, month - 1, day, hour, minute, second);
        calendar.set(GregorianCalendar.MILLISECOND, millisecond);

        // This comparision tends to be flaky (difference of 1ms)
        // Assert.assertEquals(calendar.getTimeInMillis(), StringUtils.parseTime(xmlDateTime));
        assertTrue(calendar.getTimeInMillis() + " vs. " + StringUtils.parseTime(xmlDateTime), Math.abs(calendar.getTimeInMillis() - StringUtils.parseTime(xmlDateTime).toInstant().toEpochMilli()) <= 1);
    }
/**
     * Asserts the {@link StringUtils#parseTime(String)} returns the expected values.
     *
     * @param xmlDateTime the xml date time string
     * @param year        the expected year
     * @param month       the expected month
     * @param day         the expected day
     * @param hour        the expected hour
     * @param minute      the expected minute
     * @param second      the expected second
     * @param millisecond the expected milliseconds
     */
Asserts the  StringUtils#parseTime(String) returns the expected values.
Asserts the StringUtils#parseTime ( String ) returns the expected values .
private void assertGetTime(String xmlDateTime, int year, int month, int day, int hour, int minute, int second, int millisecond) {
        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        calendar.set(year, month - 1, day, hour, minute, second);
        calendar.set(GregorianCalendar.MILLISECOND, millisecond);
        assertTrue(calendar.getTimeInMillis() + " vs. " + StringUtils.parseTime(xmlDateTime), Math.abs(calendar.getTimeInMillis() - StringUtils.parseTime(xmlDateTime).toInstant().toEpochMilli()) <= 1);
    }
private void assertGetTime ( String xmlDateTime , int year , int month , int day , int hour , int minute , int second , int millisecond ) { GregorianCalendar calendar = new GregorianCalendar ( TimeZone . getTimeZone ( "UTC" ) ) ; calendar . set ( year , month - 1 , day , hour , minute , second ) ; calendar . set ( GregorianCalendar . MILLISECOND , millisecond ) ; assertTrue ( calendar . getTimeInMillis ( ) + " vs. " + StringUtils . parseTime ( xmlDateTime ) , Math . abs ( calendar . getTimeInMillis ( ) - StringUtils . parseTime ( xmlDateTime ) . toInstant ( ) . toEpochMilli ( ) ) <= 1 ) ; }
Asserts the {@link StringUtils#parseTime(String)} returns the expected values.
Asserts the { @link StringUtils#parseTime ( String ) } returns the expected values .
// This comparision tends to be flaky (difference of 1ms) // Assert.assertEquals(calendar.getTimeInMillis(), StringUtils.parseTime(xmlDateTime));