Skip to content

Commit fdce7bd

Browse files
Fix test
1 parent a0607b2 commit fdce7bd

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemTest.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
package org.schabi.newpipe.extractor.services.youtube;
22

3-
import static org.junit.jupiter.api.Assertions.assertAll;
4-
import static org.junit.jupiter.api.Assertions.assertEquals;
5-
import static org.junit.jupiter.api.Assertions.assertFalse;
6-
import static org.junit.jupiter.api.Assertions.assertNotNull;
7-
import static org.junit.jupiter.api.Assertions.assertNull;
8-
import static org.junit.jupiter.api.Assertions.assertTrue;
9-
import static org.schabi.newpipe.downloader.DownloaderFactory.getMockPath;
10-
113
import com.grack.nanojson.JsonParser;
124
import com.grack.nanojson.JsonParserException;
13-
145
import org.junit.jupiter.api.Test;
156
import org.schabi.newpipe.extractor.localization.Localization;
167
import org.schabi.newpipe.extractor.localization.TimeAgoPatternsManager;
@@ -20,10 +11,20 @@
2011

2112
import java.io.FileInputStream;
2213
import java.io.FileNotFoundException;
14+
import java.time.LocalDateTime;
2315
import java.time.OffsetDateTime;
2416
import java.time.ZoneOffset;
17+
import java.util.TimeZone;
2518

26-
public class YoutubeStreamInfoItemTest {
19+
import static org.junit.jupiter.api.Assertions.assertAll;
20+
import static org.junit.jupiter.api.Assertions.assertEquals;
21+
import static org.junit.jupiter.api.Assertions.assertFalse;
22+
import static org.junit.jupiter.api.Assertions.assertNotNull;
23+
import static org.junit.jupiter.api.Assertions.assertNull;
24+
import static org.junit.jupiter.api.Assertions.assertTrue;
25+
import static org.schabi.newpipe.downloader.DownloaderFactory.getMockPath;
26+
27+
class YoutubeStreamInfoItemTest {
2728
@Test
2829
void videoRendererPremiere() throws FileNotFoundException, JsonParserException {
2930
final var json = JsonParser.object().from(new FileInputStream(getMockPath(
@@ -40,10 +41,14 @@ void videoRendererPremiere() throws FileNotFoundException, JsonParserException {
4041
() -> assertEquals("https://www.youtube.com/channel/UCUPrbbdnot-aPgNM65svgOg", extractor.getUploaderUrl()),
4142
() -> assertFalse(extractor.getUploaderAvatars().isEmpty()),
4243
() -> assertTrue(extractor.isUploaderVerified()),
43-
() -> assertEquals("2026-03-15 13:12", extractor.getTextualUploadDate()),
44+
() -> {
45+
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
46+
assertEquals("2026-03-15 13:12", extractor.getTextualUploadDate());
47+
},
4448
() -> {
4549
assertNotNull(extractor.getUploadDate());
46-
assertEquals(OffsetDateTime.of(2026, 3, 15, 13, 12, 0, 0, ZoneOffset.UTC), extractor.getUploadDate().offsetDateTime());
50+
final var expected = LocalDateTime.of(2026, 3, 15, 13, 12).atOffset(ZoneOffset.UTC);
51+
assertEquals(expected, extractor.getUploadDate().offsetDateTime());
4752
},
4853
() -> assertEquals(-1, extractor.getViewCount()),
4954
() -> assertFalse(extractor.getThumbnails().isEmpty()),

0 commit comments

Comments
 (0)