summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
blob: c7ed7d8125152cef5343a30cd7999231df4c252b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package de.test.antennapod.util;

import android.test.AndroidTestCase;

import de.danoeh.antennapod.core.util.Converter;

/**
 * Test class for converter
 */
public class ConverterTest extends AndroidTestCase {

    public void testGetDurationStringLong() throws Exception {
        String expected = "13:05:10";
        int input = 47110000;
        assertEquals(expected, Converter.getDurationStringLong(input));
    }

    public void testGetDurationStringShort() throws Exception {
        String expected = "13:05";
        int input = 785000;
        assertEquals(expected, Converter.getDurationStringShort(input));
    }

    public void testDurationStringLongToMs() throws Exception {
        String input = "01:20:30";
        long expected = 4830000;
        assertEquals(expected, Converter.durationStringLongToMs(input));
    }

    public void testDurationStringShortToMs() throws Exception {
        String input = "8:30";
        long expected = 510000;
        assertEquals(expected, Converter.durationStringShortToMs(input));
    }
}