X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FReplyTest.java;fp=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FReplyTest.java;h=0410ac666e809c604c009666abd8e0ce20955ea5;hp=0000000000000000000000000000000000000000;hb=fd936f56bc88ffea49bb81baf9c113fe933b14a2;hpb=3c93a3f01e3cab17bda2b97354ffee23929cb26a
diff --git a/src/test/java/net/pterodactylus/sone/data/ReplyTest.java b/src/test/java/net/pterodactylus/sone/data/ReplyTest.java
new file mode 100644
index 0000000..0410ac6
--- /dev/null
+++ b/src/test/java/net/pterodactylus/sone/data/ReplyTest.java
@@ -0,0 +1,35 @@
+package net.pterodactylus.sone.data;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.hamcrest.Matchers;
+import org.junit.Test;
+
+/**
+ * Unit test for the static elements in {@link Reply}.
+ *
+ * @author David âBombeâ Roden
+ */
+public class ReplyTest {
+
+ @Test
+ public void comparatorSortsRepliesCorrectly() {
+ Reply> reply1 = mock(Reply.class);
+ when(reply1.getTime()).thenReturn(3000L);
+ Reply> reply2 = mock(Reply.class);
+ when(reply2.getTime()).thenReturn(2000L);
+ Reply> reply3 = mock(Reply.class);
+ when(reply3.getTime()).thenReturn(1000L);
+ List> replies = new ArrayList>(Arrays.>asList(reply1, reply2, reply3));
+ Collections.sort(replies, Reply.TIME_COMPARATOR);
+ assertThat(replies, Matchers.>contains(reply3, reply2, reply1));
+ }
+
+}