1bda3441225e0607b5ced8b538123fd7c7a417910chrismair/*
2bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Copyright 2007 the original author or authors.
3bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
4bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Licensed under the Apache License, Version 2.0 (the "License");
5bda3441225e0607b5ced8b538123fd7c7a417910chrismair * you may not use this file except in compliance with the License.
6bda3441225e0607b5ced8b538123fd7c7a417910chrismair * You may obtain a copy of the License at
7bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
8bda3441225e0607b5ced8b538123fd7c7a417910chrismair *      http://www.apache.org/licenses/LICENSE-2.0
9bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
10bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Unless required by applicable law or agreed to in writing, software
11bda3441225e0607b5ced8b538123fd7c7a417910chrismair * distributed under the License is distributed on an "AS IS" BASIS,
12bda3441225e0607b5ced8b538123fd7c7a417910chrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bda3441225e0607b5ced8b538123fd7c7a417910chrismair * See the License for the specific language governing permissions and
14bda3441225e0607b5ced8b538123fd7c7a417910chrismair * limitations under the License.
15bda3441225e0607b5ced8b538123fd7c7a417910chrismair */
16bda3441225e0607b5ced8b538123fd7c7a417910chrismairpackage org.mockftpserver.core.command;
17bda3441225e0607b5ced8b538123fd7c7a417910chrismair
18bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport org.apache.log4j.Logger;
19bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport org.mockftpserver.core.session.Session;
20bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport org.mockftpserver.core.util.AssertFailedException;
21bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport org.mockftpserver.test.AbstractTestCase;
22bda3441225e0607b5ced8b538123fd7c7a417910chrismair
23bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport java.util.ArrayList;
24bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport java.util.List;
25bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport java.util.ListResourceBundle;
26bda3441225e0607b5ced8b538123fd7c7a417910chrismairimport java.util.ResourceBundle;
27bda3441225e0607b5ced8b538123fd7c7a417910chrismair
28bda3441225e0607b5ced8b538123fd7c7a417910chrismair/**
29bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Tests for SimpleCompositeCommandHandler
30bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
31bda3441225e0607b5ced8b538123fd7c7a417910chrismair * @version $Revision$ - $Date$
32bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
33bda3441225e0607b5ced8b538123fd7c7a417910chrismair * @author Chris Mair
34bda3441225e0607b5ced8b538123fd7c7a417910chrismair */
35bda3441225e0607b5ced8b538123fd7c7a417910chrismairpublic class SimpleCompositeCommandHandlerTest extends AbstractTestCase {
36bda3441225e0607b5ced8b538123fd7c7a417910chrismair
37bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private static final Logger LOG = Logger.getLogger(SimpleCompositeCommandHandlerTest.class);
38bda3441225e0607b5ced8b538123fd7c7a417910chrismair
39bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private SimpleCompositeCommandHandler simpleCompositeCommandHandler;
40bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private Session session;
41bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private Command command;
42bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private CommandHandler commandHandler1;
43bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private CommandHandler commandHandler2;
44bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private CommandHandler commandHandler3;
45bda3441225e0607b5ced8b538123fd7c7a417910chrismair
46bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
47bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand() method
48bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
49bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_OneHandler_OneInvocation() throws Exception {
50bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
51bda3441225e0607b5ced8b538123fd7c7a417910chrismair
52bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler1.handleCommand(command, session);
53bda3441225e0607b5ced8b538123fd7c7a417910chrismair        replay(commandHandler1);
54bda3441225e0607b5ced8b538123fd7c7a417910chrismair
55bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
56bda3441225e0607b5ced8b538123fd7c7a417910chrismair        verify(commandHandler1);
57bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
58bda3441225e0607b5ced8b538123fd7c7a417910chrismair
59bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
60bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand() method, with two CommandHandler defined, but with multiple invocation
61bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
62bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_TwoHandlers() throws Exception {
63bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
64bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler2);
65bda3441225e0607b5ced8b538123fd7c7a417910chrismair
66bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler1.handleCommand(command, session);
67bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler2.handleCommand(command, session);
68bda3441225e0607b5ced8b538123fd7c7a417910chrismair        replayAll();
69bda3441225e0607b5ced8b538123fd7c7a417910chrismair
70bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
71bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
72bda3441225e0607b5ced8b538123fd7c7a417910chrismair        verifyAll();
73bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
74bda3441225e0607b5ced8b538123fd7c7a417910chrismair
75bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
76bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand() method, with three CommandHandler defined, and multiple invocation
77bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
78bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_ThreeHandlers() throws Exception {
79bda3441225e0607b5ced8b538123fd7c7a417910chrismair
80bda3441225e0607b5ced8b538123fd7c7a417910chrismair        List list = new ArrayList();
81bda3441225e0607b5ced8b538123fd7c7a417910chrismair        list.add(commandHandler1);
82bda3441225e0607b5ced8b538123fd7c7a417910chrismair        list.add(commandHandler2);
83bda3441225e0607b5ced8b538123fd7c7a417910chrismair        list.add(commandHandler3);
84bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.setCommandHandlers(list);
85bda3441225e0607b5ced8b538123fd7c7a417910chrismair
86bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler1.handleCommand(command, session);
87bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler2.handleCommand(command, session);
88bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler3.handleCommand(command, session);
89bda3441225e0607b5ced8b538123fd7c7a417910chrismair        replayAll();
90bda3441225e0607b5ced8b538123fd7c7a417910chrismair
91bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
92bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
93bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
94bda3441225e0607b5ced8b538123fd7c7a417910chrismair        verifyAll();
95bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
96bda3441225e0607b5ced8b538123fd7c7a417910chrismair
97bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
98bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand() method, with a single CommandHandler defined, but too many invocations
99bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
100bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_OneHandler_TooManyInvocations() throws Exception {
101bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
102bda3441225e0607b5ced8b538123fd7c7a417910chrismair
103bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler1.handleCommand(command, session);
104bda3441225e0607b5ced8b538123fd7c7a417910chrismair        replay(commandHandler1);
105bda3441225e0607b5ced8b538123fd7c7a417910chrismair
106bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.handleCommand(command, session);
107bda3441225e0607b5ced8b538123fd7c7a417910chrismair
108bda3441225e0607b5ced8b538123fd7c7a417910chrismair        // Second invocation throws an exception
109bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
110bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.handleCommand(command, session);
111bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
112bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
113bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
114bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
115bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
116bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
117bda3441225e0607b5ced8b538123fd7c7a417910chrismair
118bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
119bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand_NoHandlersDefined() method
120bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
121bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_NoHandlersDefined() throws Exception {
122bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
123bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.handleCommand(command, session);
124bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
125bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
126bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch(AssertFailedException expected) {
127bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
128bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
129bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
130bda3441225e0607b5ced8b538123fd7c7a417910chrismair
131bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
132bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand(Command,Session) method, passing in a null Command
133bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
134bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_NullCommand() throws Exception {
135bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
136bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.handleCommand(null, session);
137bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
138bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
139bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
140bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
141bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
142bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
143bda3441225e0607b5ced8b538123fd7c7a417910chrismair
144bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
145bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the handleCommand(Command,Session) method, passing in a null Session
146bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
147bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testHandleCommand_NullSession() throws Exception {
148bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
149bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.handleCommand(command, null);
150bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
151bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
152bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
153bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
154bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
155bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
156bda3441225e0607b5ced8b538123fd7c7a417910chrismair
157bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
158bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the addCommandHandler(CommandHandler) method, passing in a null CommandHandler
159bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
160bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testAddCommandHandler_NullCommandHandler() throws Exception {
161bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
162bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.addCommandHandler(null);
163bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
164bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
165bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
166bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
167bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
168bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
169bda3441225e0607b5ced8b538123fd7c7a417910chrismair
170bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
171bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the setCommandHandlers(List) method, passing in a null
172bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
173bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testSetCommandHandlers_Null() throws Exception {
174bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
175bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.setCommandHandlers(null);
176bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
177bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
178bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
179bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
180bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
181bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
182bda3441225e0607b5ced8b538123fd7c7a417910chrismair
183bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
184bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the getCommandHandler(int) method, passing in an index for which no CommandHandler is defined
185bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
186bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testGetCommandHandler_UndefinedIndex() throws Exception {
187bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
188bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
189bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.getCommandHandler(1);
190bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
191bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
192bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
193bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
194bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
195bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
196bda3441225e0607b5ced8b538123fd7c7a417910chrismair
197bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
198bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the getCommandHandler(int) method
199bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
200bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testGetCommandHandler() throws Exception {
201bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
202bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler2);
203bda3441225e0607b5ced8b538123fd7c7a417910chrismair        assertSame("index 0", commandHandler1, simpleCompositeCommandHandler.getCommandHandler(0));
204bda3441225e0607b5ced8b538123fd7c7a417910chrismair        assertSame("index 1", commandHandler2, simpleCompositeCommandHandler.getCommandHandler(1));
205bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
206bda3441225e0607b5ced8b538123fd7c7a417910chrismair
207bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
208bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the getCommandHandler(int) method, passing in a negative index
209bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
210bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testGetCommandHandler_NegativeIndex() throws Exception {
211bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
212bda3441225e0607b5ced8b538123fd7c7a417910chrismair        try {
213bda3441225e0607b5ced8b538123fd7c7a417910chrismair            simpleCompositeCommandHandler.getCommandHandler(-1);
214bda3441225e0607b5ced8b538123fd7c7a417910chrismair            fail("Expected AssertFailedException");
215bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
216bda3441225e0607b5ced8b538123fd7c7a417910chrismair        catch (AssertFailedException expected) {
217bda3441225e0607b5ced8b538123fd7c7a417910chrismair            LOG.info("Expected: " + expected);
218bda3441225e0607b5ced8b538123fd7c7a417910chrismair        }
219bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
220bda3441225e0607b5ced8b538123fd7c7a417910chrismair
221bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
222bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the getReplyTextBundle() method
223bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
224bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testGetReplyTextBundle() {
225bda3441225e0607b5ced8b538123fd7c7a417910chrismair        assertNull(simpleCompositeCommandHandler.getReplyTextBundle());
226bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
227bda3441225e0607b5ced8b538123fd7c7a417910chrismair
228bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
229bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Test the setReplyTextBundle() method
230bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
231bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public void testSetReplyTextBundle() {
232bda3441225e0607b5ced8b538123fd7c7a417910chrismair
233bda3441225e0607b5ced8b538123fd7c7a417910chrismair        AbstractTrackingCommandHandler replyTextBundleAwareCommandHandler1 = new StaticReplyCommandHandler();
234bda3441225e0607b5ced8b538123fd7c7a417910chrismair        AbstractTrackingCommandHandler replyTextBundleAwareCommandHandler2 = new StaticReplyCommandHandler();
235bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(replyTextBundleAwareCommandHandler1);
236bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(commandHandler1);
237bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.addCommandHandler(replyTextBundleAwareCommandHandler2);
238bda3441225e0607b5ced8b538123fd7c7a417910chrismair
239bda3441225e0607b5ced8b538123fd7c7a417910chrismair        ResourceBundle resourceBundle = new ListResourceBundle() {
240bda3441225e0607b5ced8b538123fd7c7a417910chrismair            protected Object[][] getContents() {
241bda3441225e0607b5ced8b538123fd7c7a417910chrismair                return null;
242bda3441225e0607b5ced8b538123fd7c7a417910chrismair            }
243bda3441225e0607b5ced8b538123fd7c7a417910chrismair        };
244bda3441225e0607b5ced8b538123fd7c7a417910chrismair
245bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler.setReplyTextBundle(resourceBundle);
246bda3441225e0607b5ced8b538123fd7c7a417910chrismair        assertSame("1", resourceBundle, replyTextBundleAwareCommandHandler1.getReplyTextBundle());
247bda3441225e0607b5ced8b538123fd7c7a417910chrismair        assertSame("2", resourceBundle, replyTextBundleAwareCommandHandler1.getReplyTextBundle());
248bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
249bda3441225e0607b5ced8b538123fd7c7a417910chrismair
250bda3441225e0607b5ced8b538123fd7c7a417910chrismair    //-------------------------------------------------------------------------
251bda3441225e0607b5ced8b538123fd7c7a417910chrismair    // Test setup
252bda3441225e0607b5ced8b538123fd7c7a417910chrismair    //-------------------------------------------------------------------------
253bda3441225e0607b5ced8b538123fd7c7a417910chrismair
254bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
255bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * Perform initialization before each test
256bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * @see org.mockftpserver.test.AbstractTestCase#setUp()
257bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
258bda3441225e0607b5ced8b538123fd7c7a417910chrismair    protected void setUp() throws Exception {
259bda3441225e0607b5ced8b538123fd7c7a417910chrismair        super.setUp();
260bda3441225e0607b5ced8b538123fd7c7a417910chrismair        simpleCompositeCommandHandler = new SimpleCompositeCommandHandler();
261bda3441225e0607b5ced8b538123fd7c7a417910chrismair        session = (Session) createMock(Session.class);
262bda3441225e0607b5ced8b538123fd7c7a417910chrismair        command = new Command("cmd", EMPTY);
263bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler1 = (CommandHandler) createMock(CommandHandler.class);
264bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler2 = (CommandHandler) createMock(CommandHandler.class);
265bda3441225e0607b5ced8b538123fd7c7a417910chrismair        commandHandler3 = (CommandHandler) createMock(CommandHandler.class);
266bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
267bda3441225e0607b5ced8b538123fd7c7a417910chrismair
268bda3441225e0607b5ced8b538123fd7c7a417910chrismair}
269