fix testGetUploadDate for PeerTubeStreamExtractor

This commit is contained in:
bopol 2020-02-07 13:33:50 +01:00
parent 70a40e7388
commit 0f8a7f9df2

View file

@ -12,6 +12,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore; import org.junit.Ignore;
@ -42,6 +43,16 @@ public class PeertubeStreamExtractorDefaultTest {
extractor.fetchPage(); extractor.fetchPage();
} }
@Test
public void testGetUploadDate() throws ParsingException, ParseException {
final Calendar instance = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
instance.setTime(sdf.parse("2018-10-01T10:52:46.396Z"));
assertEquals(instance, requireNonNull(extractor.getUploadDate()).date());
}
@Test @Test
public void testGetInvalidTimeStamp() throws ParsingException { public void testGetInvalidTimeStamp() throws ParsingException {
assertTrue(extractor.getTimeStamp() + "", assertTrue(extractor.getTimeStamp() + "",
@ -89,15 +100,6 @@ public class PeertubeStreamExtractorDefaultTest {
extractor.getViewCount() > 10); extractor.getViewCount() > 10);
} }
@Ignore //fixme
@Test
public void testGetUploadDate() throws ParsingException, ParseException {
final Calendar instance = Calendar.getInstance();
instance.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'").parse("2018-10-01T11:52:46.396Z"));
assertEquals(instance, requireNonNull(extractor.getUploadDate()).date());
}
@Test @Test
public void testGetUploaderUrl() throws ParsingException { public void testGetUploaderUrl() throws ParsingException {
assertIsSecureUrl(extractor.getUploaderUrl()); assertIsSecureUrl(extractor.getUploaderUrl());