✅ Add more tests for FreenetTemplatePage
[Sone.git] / src / test / java / net / pterodactylus / sone / core / SoneUriTest.java
1 package net.pterodactylus.sone.core;
2
3 import static freenet.keys.InsertableClientSSK.createRandom;
4 import static net.pterodactylus.sone.core.SoneUri.create;
5 import static org.hamcrest.MatcherAssert.assertThat;
6 import static org.hamcrest.Matchers.is;
7 import static org.hamcrest.Matchers.nullValue;
8
9 import freenet.crypt.DummyRandomSource;
10 import freenet.keys.FreenetURI;
11
12 import org.junit.Test;
13
14 /**
15  * Unit test for {@link SoneUri}.
16  */
17 public class SoneUriTest {
18
19         @Test
20         public void callConstructorForIncreasedTestCoverage() {
21                 new SoneUri();
22         }
23
24         @Test
25         public void returnedUriHasCorrectDocNameAndMetaStrings() {
26                 FreenetURI uri = createRandom(new DummyRandomSource(), "test-0").getURI().uskForSSK();
27                 assertThat(create(uri.toString()).getDocName(), is("Sone"));
28                 assertThat(create(uri.toString()).getAllMetaStrings(), is(new String[0]));
29         }
30
31         @Test
32         public void malformedUriReturnsNull() {
33                 assertThat(create("not a key"), nullValue());
34         }
35
36 }