diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java index 7dd371c28..0ada81f33 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java @@ -13,6 +13,7 @@ import org.schabi.newpipe.extractor.stream.StreamExtractor; import java.io.IOException; import java.util.Calendar; +import java.util.TimeZone; import static org.junit.Assert.*; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp; @@ -57,12 +58,19 @@ public class BandcampRadioStreamExtractorTest { @Test public void testGetTextualUploadDate() throws ParsingException { - assertEquals("16 May 2017", e.getTextualUploadDate()); + assertEquals("16 May 2017 00:00:00 GMT", e.getTextualUploadDate()); } @Test public void testUploadDate() throws ParsingException { - assertEquals(136, e.getUploadDate().date().get(Calendar.DAY_OF_YEAR)); + final Calendar expectedCalendar = Calendar.getInstance(); + + // 16 May 2017 00:00:00 GMT + expectedCalendar.setTimeZone(TimeZone.getTimeZone("GMT")); + expectedCalendar.setTimeInMillis(0); + expectedCalendar.set(2017, Calendar.MAY, 16); + + assertEquals(expectedCalendar.getTimeInMillis(), e.getUploadDate().date().getTimeInMillis()); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java index 7c8d4c863..c631ca964 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java @@ -14,6 +14,7 @@ import org.schabi.newpipe.extractor.stream.StreamExtractor; import java.io.IOException; import java.util.Calendar; +import java.util.TimeZone; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -63,7 +64,13 @@ public class BandcampStreamExtractorTest { @Test public void testUploadDate() throws ParsingException { - assertEquals(270, extractor.getUploadDate().date().get(Calendar.DAY_OF_YEAR)); + final Calendar expectedCalendar = Calendar.getInstance(); + // 27 Sep 2019 21:49:14 GMT + expectedCalendar.setTimeZone(TimeZone.getTimeZone("GMT")); + expectedCalendar.set(2019, Calendar.SEPTEMBER, 27, 21, 49, 14); + expectedCalendar.set(Calendar.MILLISECOND, 0); + + assertEquals(expectedCalendar.getTimeInMillis(), extractor.getUploadDate().date().getTimeInMillis()); } @Test