summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/de/test
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2019-03-03 23:55:52 +0100
committerByteHamster <info@bytehamster.com>2019-03-03 23:55:52 +0100
commitc50d37fa1bbabd60278aecc9516a4e18e6d0dc10 (patch)
tree244134dda9958fb6849ccddae29098fe29c6bff6 /app/src/androidTest/java/de/test
parent1593a0607774a157dffa6c95e068b6ab3b077cf7 (diff)
downloadAntennaPod-c50d37fa1bbabd60278aecc9516a4e18e6d0dc10.zip
Moved some implementation tests to unit tests
Diffstat (limited to 'app/src/androidTest/java/de/test')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java35
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java51
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java22
3 files changed, 0 insertions, 108 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
deleted file mode 100644
index cd1a489d8..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-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";
- assertEquals(expected, Converter.getDurationStringShort(47110000, true));
- assertEquals(expected, Converter.getDurationStringShort(785000, false));
- }
-
- 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";
- assertEquals(30600000, Converter.durationStringShortToMs(input, true));
- assertEquals(510000, Converter.durationStringShortToMs(input, false));
- }
-}
diff --git a/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java b/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java
deleted file mode 100644
index d564d0492..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package de.test.antennapod.util;
-
-import junit.framework.TestCase;
-
-import de.danoeh.antennapod.core.util.RewindAfterPauseUtils;
-
-/**
- * Tests for {@link RewindAfterPauseUtils}.
- */
-public class RewindAfterPauseUtilTest extends TestCase {
-
- public void testCalculatePositionWithRewindNoRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis();
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION, position);
- }
-
- public void testCalculatePositionWithRewindSmallRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_SHORT_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.SHORT_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindMediumRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_MEDIUM_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.MEDIUM_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindLongRewind() {
- final int ORIGINAL_POSITION = 30000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_LONG_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.LONG_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindNegativeNumber() {
- final int ORIGINAL_POSITION = 100;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_LONG_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(0, position);
- }
-}
diff --git a/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java b/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java
deleted file mode 100644
index 2cca6b4dc..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package de.test.antennapod.util;
-
-import android.test.AndroidTestCase;
-
-import de.danoeh.antennapod.core.util.URIUtil;
-
-/**
- * Test class for URIUtil
- */
-public class URIUtilTest extends AndroidTestCase {
-
- public void testGetURIFromRequestUrlShouldNotEncode() {
- final String testUrl = "http://example.com/this%20is%20encoded";
- assertEquals(testUrl, URIUtil.getURIFromRequestUrl(testUrl).toString());
- }
-
- public void testGetURIFromRequestUrlShouldEncode() {
- final String testUrl = "http://example.com/this is not encoded";
- final String expected = "http://example.com/this%20is%20not%20encoded";
- assertEquals(expected, URIUtil.getURIFromRequestUrl(testUrl).toString());
- }
-}