blob: 8392dcce60dcd0b0528cf8eac3761b22a3ac3040 [file] [log] [blame]
chrismair00dc7bd2014-05-11 21:21:28 +00001/*
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 QuitCommandHandler class
23 *
24 * @version $Revision$ - $Date$
25 *
26 * @author Chris Mair
27 */
28public final class QuitCommandHandlerTest extends AbstractCommandHandlerTestCase {
29
30 private QuitCommandHandler commandHandler;
31
32 /**
33 * Test the handleCommand() method
34 */
35 public void testHandleCommand() throws Exception {
36 final Command COMMAND = new Command(CommandNames.QUIT, EMPTY);
37
38 session.sendReply(ReplyCodes.QUIT_OK, replyTextFor(ReplyCodes.QUIT_OK));
39 session.close();
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.core.command.AbstractCommandHandlerTestCase#setUp()
53 */
54 protected void setUp() throws Exception {
55 super.setUp();
56 commandHandler = new QuitCommandHandler();
57 commandHandler.setReplyTextBundle(replyTextBundle);
58 }
59
60}