Move reply mocking into its own helper class.
[xudocci.git] / src / test / java / net / pterodactylus / irc / connection / Replies.java
1 package net.pterodactylus.irc.connection;
2
3 import static java.util.Arrays.asList;
4 import static org.mockito.Mockito.mock;
5 import static org.mockito.Mockito.when;
6
7 import net.pterodactylus.irc.Reply;
8
9 /**
10  * Helper class to mock {@link Reply}s for testing {@link Handler}s.
11  *
12  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
13  */
14 public class Replies {
15
16         public static Reply createReply(String command, String channel) {
17                 final Reply reply = mock(Reply.class);
18                 when(reply.command()).thenReturn(command);
19                 when(reply.parameters()).thenReturn(asList(":some.server", channel));
20                 return reply;
21         }
22
23         public static Reply createReply(String command) {
24                 Reply reply = mock(Reply.class);
25                 return when(reply.command()).thenReturn(command).getMock();
26         }
27
28 }