Automatically en- and decode peer note texts
[jFCPlib.git] / src / test / java / net / pterodactylus / fcp / ModifyPeerNoteTest.java
1 package net.pterodactylus.fcp;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5
6 import org.junit.Test;
7
8 /**
9  * Unit test for {@link ModifyPeerNote}.
10  *
11  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
12  */
13 public class ModifyPeerNoteTest {
14
15         private static final String IDENTIFIER = "identifier";
16         private static final String NODE_IDENTIFIER = "node_identifier";
17         private static final String ENCODED_NOTE_TEXT = "VWJlck5vZGUgKHVudGlsIEkgaGF2ZSByZWFsIHBlZXJzKQ==";
18         private static final String DECODED_NOTE_TEXT = "UberNode (until I have real peers)";
19
20         @Test
21         public void noteTextIsEncodedCorrectly() {
22             ModifyPeerNote modifyPeerNote = new ModifyPeerNote(IDENTIFIER, NODE_IDENTIFIER);
23                 modifyPeerNote.setNoteText(DECODED_NOTE_TEXT);
24                 assertThat(modifyPeerNote.getField("NoteText"), is(ENCODED_NOTE_TEXT));
25         }
26
27
28 }