--- /dev/null
+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 <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+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<Reply<?>> replies = new ArrayList<Reply<?>>(Arrays.<Reply<?>>asList(reply1, reply2, reply3));
+ Collections.sort(replies, Reply.TIME_COMPARATOR);
+ assertThat(replies, Matchers.<Reply<?>>contains(reply3, reply2, reply1));
+ }
+
+}