177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair/*
277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * Copyright 2007 the original author or authors.
377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair *
477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * Licensed under the Apache License, Version 2.0 (the "License");
577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * you may not use this file except in compliance with the License.
677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * You may obtain a copy of the License at
777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair *
877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair *      http://www.apache.org/licenses/LICENSE-2.0
977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair *
1077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * Unless required by applicable law or agreed to in writing, software
1177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * distributed under the License is distributed on an "AS IS" BASIS,
1277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * See the License for the specific language governing permissions and
1477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * limitations under the License.
1577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair */
1677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairpackage org.mockftpserver.core.command;
1777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
1877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport org.apache.log4j.Logger;
1977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport org.easymock.MockControl;
2077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport org.mockftpserver.core.session.Session;
2177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport org.mockftpserver.test.AbstractTest;
2277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
2377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport java.text.MessageFormat;
2477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport java.util.ListResourceBundle;
2577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairimport java.util.ResourceBundle;
2677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
2777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair/**
2877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * Abstract superclass for CommandHandler tests
2977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair *
3077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * @author Chris Mair
3177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair * @version $Revision$ - $Date$
3277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair */
3377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismairpublic abstract class AbstractCommandHandlerTest extends AbstractTest {
3477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
3577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    private static final Logger LOG = Logger.getLogger(AbstractCommandHandlerTest.class);
3677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
3777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    // Some common test constants
3877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected static final String DIR1 = "dir1";
3977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected static final String DIR2 = "dir2";
4077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected static final String FILENAME1 = "sample1.txt";
4177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected static final String FILENAME2 = "sample2.txt";
4277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
4377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected Session session;
4477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected ResourceBundle replyTextBundle;
4577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
4677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
4777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Test the handleCommand() method, when one or more parameter is missing or invalid
4877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
4977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param commandHandler - the CommandHandler to test
5077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param commandName    - the name for the Command
5177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param parameters     - the Command parameters
5277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
5377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void testHandleCommand_InvalidParameters(AbstractTrackingCommandHandler commandHandler,
5477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                                                       String commandName, String[] parameters) throws Exception {
5577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        Command command = new Command(commandName, parameters);
5677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        session.sendReply(ReplyCodes.COMMAND_SYNTAX_ERROR, replyTextFor(ReplyCodes.COMMAND_SYNTAX_ERROR));
5777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        replay(session);
5877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
5977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        commandHandler.handleCommand(command, session);
6077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        verify(session);
6177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
6277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        verifyNumberOfInvocations(commandHandler, 1);
6377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        verifyNoDataElements(commandHandler.getInvocation(0));
6477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
6577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
6677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
6777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Verify that the CommandHandler contains the specified number of invocation records
6877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
6977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param commandHandler - the CommandHandler
7077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param expected       - the expected number of invocations
7177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
7277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void verifyNumberOfInvocations(InvocationHistory commandHandler, int expected) {
7377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEquals("number of invocations", expected, commandHandler.numberOfInvocations());
7477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
7577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
7677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
7777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Verify that the InvocationRecord contains no data elements
7877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
7977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param invocationRecord - the InvocationRecord
8077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
8177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void verifyNoDataElements(InvocationRecord invocationRecord) {
8277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        LOG.info("Verifying: " + invocationRecord);
8377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEquals("number of data elements", 0, invocationRecord.keySet().size());
8477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
8577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
8677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
8777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Verify that the InvocationRecord contains exactly one data element, with the specified key
8877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * and value.
8977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
9077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param invocationRecord - the InvocationRecord
9177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param key              - the expected key
9277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param value            - the expected value
9377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
9477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void verifyOneDataElement(InvocationRecord invocationRecord, String key, Object value) {
9577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        LOG.info("Verifying: " + invocationRecord);
9677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEquals("number of data elements", 1, invocationRecord.keySet().size());
9777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEqualsAllTypes("value:" + value, value, invocationRecord.getObject(key));
9877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
9977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
10077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
10177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Verify that the InvocationRecord contains exactly two data element, with the specified keys
10277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * and values.
10377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
10477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param invocationRecord - the InvocationRecord
10577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param key1             - the expected key1
10677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param value1           - the expected value1
10777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param key2             - the expected key2
10877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param value2-          the expected value2
10977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
11077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void verifyTwoDataElements(InvocationRecord invocationRecord, String key1, Object value1,
11177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                                         String key2, Object value2) {
11277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
11377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        LOG.info("Verifying: " + invocationRecord);
11477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEquals("number of data elements", 2, invocationRecord.keySet().size());
11577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEqualsAllTypes("value1:" + value1, value1, invocationRecord.getObject(key1));
11677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        assertEqualsAllTypes("value2:" + value2, value2, invocationRecord.getObject(key2));
11777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
11877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
11977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
12077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Assert that the actual is equal to the expected, using arrays equality comparison if
12177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * necessary
12277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
12377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param message  - the message, used if the comparison fails
12477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param expected - the expected value
12577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param actual   - the actual value
12677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
12777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    private void assertEqualsAllTypes(String message, Object expected, Object actual) {
12877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
12977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        if (expected instanceof byte[] || actual instanceof byte[]) {
13077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair            assertEquals(message, (byte[]) expected, (byte[]) actual);
13177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        } else if (expected instanceof Object[] || actual instanceof Object[]) {
13277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair            assertEquals(message, (Object[]) expected, (Object[]) actual);
13377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        } else {
13477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair            assertEquals(message, expected, actual);
13577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        }
13677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
13777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
13877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
13977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Perform setup before each test
14077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
14177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @see org.mockftpserver.test.AbstractTest#setUp()
14277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
14377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected void setUp() throws Exception {
14477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        super.setUp();
14577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
14677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        session = (Session) createMock(Session.class);
14777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        control(session).setDefaultMatcher(MockControl.ARRAY_MATCHER);
14877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        control(session).expectAndDefaultReturn(session.getClientHost(), DEFAULT_HOST);
14977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
15077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        replyTextBundle = new ListResourceBundle() {
15177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair            protected Object[][] getContents() {
15277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                return new Object[][]{
15377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"150", replyTextFor(150)},
15477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"200", replyTextFor(200)},
15577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"211", replyTextWithParameterFor(211)},
15677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"213", replyTextWithParameterFor(213)},
15777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"214", replyTextWithParameterFor(214)},
15877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"215", replyTextWithParameterFor(215)},
15977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"220", replyTextFor(220)},
16077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"221", replyTextFor(221)},
16177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"226", replyTextFor(226)},
16277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"226.WithFilename", replyTextWithParameterFor("226.WithFilename")},
16377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"227", replyTextWithParameterFor(227)},
16477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"229", replyTextWithParameterFor(229)},
16577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"230", replyTextFor(230)},
16677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"250", replyTextFor(250)},
16777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"257", replyTextWithParameterFor(257)},
16877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"331", replyTextFor(331)},
16977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"350", replyTextFor(350)},
17077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"501", replyTextFor(501)},
17177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                        {"502", replyTextFor(502)},
17277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair                };
17377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair            }
17477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        };
17577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
17677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
17777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
17877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Return the test-specific reply text for the specified reply code
17977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
18077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param replyCode - the reply code
18177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @return the reply text for the specified reply code
18277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
18377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected String replyTextFor(int replyCode) {
18477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        return "Reply for " + replyCode;
18577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
18677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
18777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
18877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Return the test-specific parameterized reply text for the specified reply code
18977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
19077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param replyCode - the reply code
19177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @return the reply text for the specified reply code
19277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
19377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected String replyTextWithParameterFor(int replyCode) {
19477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        return "Reply for " + replyCode + ":{0}";
19577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
19677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
19777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
19877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Return the test-specific parameterized reply text for the specified messageKey
19977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
20077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param messageKey - the messageKey
20177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @return the reply text for the specified messageKey
20277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
20377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected String replyTextWithParameterFor(String messageKey) {
20477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        return "Reply for " + messageKey + ":{0}";
20577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
20677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
20777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
20877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Return the test-specific reply text for the specified reply code and message parameter
20977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
21077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param replyCode - the reply code
21177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param parameter - the message parameter value
21277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @return the reply text for the specified reply code
21377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
21477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected String formattedReplyTextFor(int replyCode, Object parameter) {
21577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        return MessageFormat.format(replyTextWithParameterFor(replyCode), objArray(parameter));
21677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
21777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
21877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    /**
21977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * Return the test-specific reply text for the specified message key and message parameter
22077b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     *
22177b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param messageKey - the messageKey
22277b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @param parameter  - the message parameter value
22377b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     * @return the reply text for the specified message key and parameter
22477b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair     */
22577b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    protected String formattedReplyTextFor(String messageKey, Object parameter) {
22677b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair        return MessageFormat.format(replyTextWithParameterFor(messageKey), objArray(parameter));
22777b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair    }
22877b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair
22977b8661f08d1379c0bdf2af93d8004fced9f1ab0chrismair}
230