mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-14 22:30:33 +05:30
Bandcamp: Test full date
This commit is contained in:
parent
27e7aad159
commit
e6ecd91929
@ -13,6 +13,7 @@ import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
|
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
|
||||||
@ -57,12 +58,19 @@ public class BandcampRadioStreamExtractorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetTextualUploadDate() throws ParsingException {
|
public void testGetTextualUploadDate() throws ParsingException {
|
||||||
assertEquals("16 May 2017", e.getTextualUploadDate());
|
assertEquals("16 May 2017 00:00:00 GMT", e.getTextualUploadDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploadDate() throws ParsingException {
|
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
|
@Test
|
||||||
|
@ -14,6 +14,7 @@ import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -63,7 +64,13 @@ public class BandcampStreamExtractorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUploadDate() throws ParsingException {
|
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
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user