ShowCommandTest.java :  » Database-Client » sqlshell » nl » improved » sqlclient » commands » Java Open Source

Java Open Source » Database Client » sqlshell 
sqlshell » nl » improved » sqlclient » commands » ShowCommandTest.java
/*
 * Copyright 2007 Roy van der Kuil (roy@vanderkuil.nl) and Stefan Rotman (stefan@rotman.net)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.improved.sqlclient.commands;

import nl.improved.sqlclient.*;
import java.util.Arrays;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class ShowCommandTest extends TestCase {

    private static final boolean testFailures = true;

    public ShowCommandTest() {
    }

    public void testGetTabCompletionInfo() {
        ShowCommand cmd = new ShowCommand();
        SQLCommand sqlCommand = new SQLCommand();
        sqlCommand.getEditableLines().add(new StringBuilder("SHOW TABLES HAVING "));
        Point cursorPos = new Point(sqlCommand.getLines().get(0).length(),0);
        TabCompletionInfo info = cmd.getTabCompletionInfo(sqlCommand, cursorPos);
        assertNotNull(info);
        assertEquals(TabCompletionInfo.MatchType.COLUMN_NAMES, info.getMatchType());
        assertEquals(1, info.getPossibleMatches().size());
        assertEquals("%", info.getPossibleMatches().get(0));
        assertEquals("", info.getStart());
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.