import static net.pterodactylus.irc.Source.parseSource;
import static net.pterodactylus.irc.connection.Replies.createReply;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentCaptor.forClass;
import static org.mockito.Matchers.anyObject;
}
@Test
+ public void dccCommandWithTokenIsRecognizedCorrectly() {
+ handler.handleReply(createReply(parseSource("User!user@host"), "PRIVMSG", "\u0001DCC SEND filename 1234 0 12345 T123\u0001"));
+ ArgumentCaptor<DccSendReceived> dccSendReceivedCaptor = forClass(DccSendReceived.class);
+ verify(eventBus).post(dccSendReceivedCaptor.capture());
+ assertThat(dccSendReceivedCaptor.getAllValues(), hasSize(1));
+ DccSendReceived dccSendReceived = dccSendReceivedCaptor.getValue();
+ assertThat(dccSendReceived.token(), equalTo("T123"));
+ }
+
+ @Test
public void dccAcceptCommandIsRecognized() {
handler.handleReply(createReply(parseSource("User!user@host"),
"NOTICE",