summaryrefslogtreecommitdiff
path: root/src/instrumentationTest/de/test/antennapod/util/ConverterTest.java
blob: 8e5674b062ac62af333ec5c35fa18b1bc3c80e92 (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 instrumentationTest.de.test.antennapod.util;

import android.test.AndroidTestCase;

import de.danoeh.antennapod.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 = 47110000;
        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 = 30600000;
        assertEquals(expected, Converter.durationStringShortToMs(input));
    }
}