X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParserTest.java;h=46eecb790848cbc7ce8fb49b0bf365833a1eb732;hb=cdee9199c8ab6a1646ef9fce6930ce41f1b1b25b;hp=b763cd1ebf8ec54b4209aaac15229fc0fd5b42d8;hpb=8e313509a42a8c638fcac018dd73dd975bf9cb68;p=Sone.git
diff --git a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java
index b763cd1..46eecb7 100644
--- a/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java
+++ b/src/test/java/net/pterodactylus/sone/text/SoneTextParserTest.java
@@ -41,8 +41,6 @@ import org.junit.Test;
/**
* JUnit test case for {@link SoneTextParser}.
- *
- * @author David âBombeâ Roden
*/
public class SoneTextParserTest {
@@ -213,6 +211,17 @@ public class SoneTextParserTest {
}
@Test
+ public void sskWithoutDocumentNameIsParsedCorrectly() {
+ Iterable parts = soneTextParser.parse(
+ "SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8",
+ null);
+ assertThat("Part Text", convertText(parts),
+ is("[SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8|"
+ + "SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8|"
+ + "SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU]"));
+ }
+
+ @Test
public void sskLinkWithoutContextIsNotTrusted() {
Iterable parts = soneTextParser.parse("SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8/test", null);
assertThat("Part Text", convertText(parts), is("[SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8/test|SSK@qM1nmgU-YUnIttmEhqjTl7ifAF3Z6o~5EPwQW03uEQU,aztSUkT-VT1dWvfSUt9YpfyW~Flmf5yXpBnIE~v8sAg,AAMC--8/test|test]"));
@@ -408,8 +417,6 @@ public class SoneTextParserTest {
/**
* Mock Sone provider.
- *
- * @author David âBombeâ Roden
*/
private static class TestSoneProvider implements SoneProvider {
@@ -467,9 +474,10 @@ public class SoneTextParserTest {
private static class TestPostProvider implements PostProvider {
+ @Nullable
@Override
- public Optional getPost(final String postId) {
- return Optional.of(new Post() {
+ public Post getPost(@Nonnull final String postId) {
+ return new Post() {
@Override
public String getId() {
return postId;
@@ -514,7 +522,7 @@ public class SoneTextParserTest {
public Post setKnown(boolean known) {
return null;
}
- });
+ };
}
@Override
@@ -531,9 +539,10 @@ public class SoneTextParserTest {
private static class AbsentPostProvider extends TestPostProvider {
+ @Nullable
@Override
- public Optional getPost(String postId) {
- return Optional.absent();
+ public Post getPost(@Nonnull String postId) {
+ return null;
}
}