public void handleIrcError(int num) {
        if (IRCConstants.ERR_NICKNAMEINUSE == num) {
            handleNickInUse();
        }
    }
@Test
    public void doHandleIrcErrorNickInUse() {
        when(connection.getNick()).thenReturn("nick");
        endpoint.handleIrcError(IRCConstants.ERR_NICKNAMEINUSE);

        verify(connection).doNick("nick-");
        when(connection.getNick()).thenReturn("nick---");

        // confirm doNick was not called
        verify(connection, never()).doNick("foo");
    }