mirror of
https://github.com/Athou/commafeed.git
synced 2026-11-02 10:24:48 +00:00
use google java formatter to avoid downloading eclipse during build
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
package com.commafeed.backend.urlprovider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class InPageReferenceFeedURLProviderTest {
|
||||
|
||||
private final InPageReferenceFeedURLProvider provider = new InPageReferenceFeedURLProvider();
|
||||
private final InPageReferenceFeedURLProvider provider = new InPageReferenceFeedURLProvider();
|
||||
|
||||
@Test
|
||||
void extractUrls() {
|
||||
String url = "http://example.com";
|
||||
String html = """
|
||||
@Test
|
||||
void extractUrls() {
|
||||
String url = "http://example.com";
|
||||
String html =
|
||||
"""
|
||||
<html>
|
||||
<head>
|
||||
<link type="application/atom+xml" href="/feed.atom">
|
||||
@@ -22,24 +22,28 @@ class InPageReferenceFeedURLProviderTest {
|
||||
</body>
|
||||
</html>""";
|
||||
|
||||
Assertions.assertIterableEquals(List.of("http://example.com/feed.atom", "http://example.com/feed.rss"), provider.get(url, html));
|
||||
}
|
||||
Assertions.assertIterableEquals(
|
||||
List.of("http://example.com/feed.atom", "http://example.com/feed.rss"),
|
||||
provider.get(url, html));
|
||||
}
|
||||
|
||||
@Test
|
||||
void returnsEmptyListForNonHtmlContent() {
|
||||
String url = "http://example.com";
|
||||
String html = """
|
||||
@Test
|
||||
void returnsEmptyListForNonHtmlContent() {
|
||||
String url = "http://example.com";
|
||||
String html =
|
||||
"""
|
||||
<?xml version="1.0"?>
|
||||
<feed></feed>
|
||||
</xml>""";
|
||||
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void returnsEmptyListForHtmlWithoutFeedLinks() {
|
||||
String url = "http://example.com";
|
||||
String html = """
|
||||
@Test
|
||||
void returnsEmptyListForHtmlWithoutFeedLinks() {
|
||||
String url = "http://example.com";
|
||||
String html =
|
||||
"""
|
||||
<html>
|
||||
<head>
|
||||
<link type="text/css" href="/style.css">
|
||||
@@ -48,6 +52,6 @@ class InPageReferenceFeedURLProviderTest {
|
||||
</body>
|
||||
</html>""";
|
||||
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package com.commafeed.backend.urlprovider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class YoutubeFeedURLProviderTest {
|
||||
|
||||
private final YoutubeFeedURLProvider provider = new YoutubeFeedURLProvider();
|
||||
private final YoutubeFeedURLProvider provider = new YoutubeFeedURLProvider();
|
||||
|
||||
@Test
|
||||
void matchesYoutubeChannelURL() {
|
||||
Assertions.assertIterableEquals(List.of("https://www.youtube.com/feeds/videos.xml?channel_id=abc"),
|
||||
provider.get("https://www.youtube.com/channel/abc", null));
|
||||
}
|
||||
@Test
|
||||
void matchesYoutubeChannelURL() {
|
||||
Assertions.assertIterableEquals(
|
||||
List.of("https://www.youtube.com/feeds/videos.xml?channel_id=abc"),
|
||||
provider.get("https://www.youtube.com/channel/abc", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void doesNotmatchYoutubeChannelURL() {
|
||||
Assertions.assertTrue(provider.get("https://www.anothersite.com/channel/abc", null).isEmpty());
|
||||
Assertions.assertTrue(provider.get("https://www.youtube.com/user/abc", null).isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
@Test
|
||||
void doesNotmatchYoutubeChannelURL() {
|
||||
Assertions.assertTrue(
|
||||
provider.get("https://www.anothersite.com/channel/abc", null).isEmpty());
|
||||
Assertions.assertTrue(provider.get("https://www.youtube.com/user/abc", null).isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user