01: /*
02: * Copyright 2007 Roy van der Kuil (roy@vanderkuil.nl) and Stefan Rotman (stefan@rotman.net)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */
16:
17: package nl.improved.sqlclient.commands;
18:
19: import nl.improved.sqlclient.*;
20: import java.util.Arrays;
21: import java.util.List;
22: import junit.framework.Test;
23: import junit.framework.TestCase;
24: import junit.framework.TestSuite;
25:
26: public class ShowCommandTest extends TestCase {
27:
28: private static final boolean testFailures = true;
29:
30: public ShowCommandTest() {
31: }
32:
33: public void testGetTabCompletionInfo() {
34: ShowCommand cmd = new ShowCommand();
35: SQLCommand sqlCommand = new SQLCommand();
36: sqlCommand.getEditableLines().add(
37: new StringBuilder("SHOW TABLES HAVING "));
38: Point cursorPos = new Point(sqlCommand.getLines().get(0)
39: .length(), 0);
40: TabCompletionInfo info = cmd.getTabCompletionInfo(sqlCommand,
41: cursorPos);
42: assertNotNull(info);
43: assertEquals(TabCompletionInfo.MatchType.COLUMN_NAMES, info
44: .getMatchType());
45: assertEquals(1, info.getPossibleMatches().size());
46: assertEquals("%", info.getPossibleMatches().get(0));
47: assertEquals("", info.getStart());
48: }
49:
50: }
|