AborCommandHandlerTest.java revision 40658190151b7ded3489ff89c301b470155c95f4
1/*
2 * Copyright 2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.mockftpserver.stub.command;
17
18import org.mockftpserver.core.command.*;
19import org.mockftpserver.core.command.AbstractCommandHandlerTestCase;
20
21/**
22 * Tests for the AborCommandHandler class
23 *
24 * @version $Revision$ - $Date$
25 *
26 * @author Chris Mair
27 */
28public final class AborCommandHandlerTest extends AbstractCommandHandlerTestCase {
29
30    private AborCommandHandler commandHandler;
31
32    /**
33     * Test the handleCommand() method
34     */
35    public void testHandleCommand() throws Exception {
36        final Command COMMAND = new Command(CommandNames.ABOR, EMPTY);
37
38        session.sendReply(ReplyCodes.ABOR_OK, replyTextFor(ReplyCodes.ABOR_OK));
39        replay(session);
40
41        commandHandler.handleCommand(COMMAND, session);
42        verify(session);
43
44        verifyNumberOfInvocations(commandHandler, 1);
45        verifyNoDataElements(commandHandler.getInvocation(0));
46    }
47
48    /**
49     * Perform initialization before each test
50     *
51     * @see org.mockftpserver.core.command.AbstractCommandHandlerTestCase#setUp()
52     */
53    protected void setUp() throws Exception {
54        super.setUp();
55        commandHandler = new AborCommandHandler();
56        commandHandler.setReplyTextBundle(replyTextBundle);
57    }
58
59}
60