AborCommandHandlerTest.java revision 93102446a7b7c3d17888064b4e2e4e5cb534e6d0
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.Command;
19import org.mockftpserver.core.command.CommandNames;
20import org.mockftpserver.core.command.ReplyCodes;
21
22/**
23 * Tests for the AborCommandHandler class
24 *
25 * @version $Revision: 139 $ - $Date: 2007-12-11 20:58:30 -0500 (Tue, 11 Dec 2007) $
26 *
27 * @author Chris Mair
28 */
29public final class AborCommandHandlerTest extends AbstractCommandHandlerTest {
30
31    private AborCommandHandler commandHandler;
32
33    /**
34     * Test the handleCommand() method
35     */
36    public void testHandleCommand() throws Exception {
37        final Command COMMAND = new Command(CommandNames.ABOR, EMPTY);
38
39        session.sendReply(ReplyCodes.ABOR_OK, replyTextFor(ReplyCodes.ABOR_OK));
40        replay(session);
41
42        commandHandler.handleCommand(COMMAND, session);
43        verify(session);
44
45        verifyNumberOfInvocations(commandHandler, 1);
46        verifyNoDataElements(commandHandler.getInvocation(0));
47    }
48
49    /**
50     * Perform initialization before each test
51     *
52     * @see org.mockftpserver.stub.command.AbstractCommandHandlerTest#setUp()
53     */
54    protected void setUp() throws Exception {
55        super.setUp();
56        commandHandler = new AborCommandHandler();
57        commandHandler.setReplyTextBundle(replyTextBundle);
58    }
59
60}
61