Add test for PlainTextPart
[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  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
18  */
19 public class SoneUriTest {
20
21         @Test
22         public void callConstructorForIncreasedTestCoverage() {
23                 new SoneUri();
24         }
25
26         @Test
27         public void returnedUriHasCorrectDocNameAndMetaStrings() {
28                 FreenetURI uri = createRandom(new DummyRandomSource(), "test-0").getURI().uskForSSK();
29                 assertThat(create(uri.toString()).getDocName(), is("Sone"));
30                 assertThat(create(uri.toString()).getAllMetaStrings(), is(new String[0]));
31         }
32
33         @Test
34         public void malformedUriReturnsNull() {
35                 assertThat(create("not a key"), nullValue());
36         }
37
38 }