name.angoca.db2sa.core.lexical.impl
Class ImplementationLexicalAnalyzerTest

Package class diagram package ImplementationLexicalAnalyzerTest
java.lang.Object
  extended by name.angoca.db2sa.core.lexical.impl.ImplementationLexicalAnalyzerTest

public final class ImplementationLexicalAnalyzerTest
extends Object

This is the set of test for the lexical analyzer. The inputs are phrases that represents the user's command, they are received like strings and this class tests its conversion to Tokens and analyze the results.

Control Version

Version:
1.7.1 2010-05-17
Author:
Andres Gomez Casanova (AngocA)

Constructor Summary
ImplementationLexicalAnalyzerTest()
          Default constructor.
 
Method Summary
static void setUpBeforeClass()
          Load the graph.
static void tearDownAfterClass()
          Clears the configuration file name property at the end of the test.
 void testCloseFirstParenthesis()
          Test of the options for the 'create table t1 (c1 int, c2 char(10' command.
 void testComma()
          Test of the options for the 'create table t2(c1 int' command.
 void testConvertionCrea()
          Tests the token conversion.
 void testConvertionCreateTab()
          Tests the token conversion 'create tab' -> 'create tab'.
 void testCreaPhrase1()
          Test to complete the phrase crea (phrase).
 void testCreaPhrase2()
          Test to complete the phrase crea (options).
 void testCreaPhrase3()
          Test that the phrase 'crea' does not have several phrases.
 void testCreaPhrase4()
          Test to complete the phrase 'crea' (object).
 void testCreateCommand()
          Test of the options for the 'create' command.
 void testCreateTab()
          Test the token completion tab -> table.
 void testCreateTableCommand1()
          Test of the options for the 'create table' command.
 void testCreateTableCommand2()
          Test of the options for the 'create table' command.
 void testCreateTableCommand3()
          Test of the options for the 'create table' command.
 void testCreateTableCommand4()
          Test of the options for the 'create table' command.
 void testCreateTableCommand4WithSpace()
          Test of the options for the 'create table ' command.
 void testCreateTableTableNameCommand()
          Test of the options for the 'create table <tableName>' command.
 void testCTtnParenthesis()
          Test of the options for the 'create table <tableName>(' command.
 void testCTtnSpaceParenthesis()
          Test of the options for the 'create table <tableName> (' command.
 void testCTtnSpaceParenthesisWithSpace()
          Test of the options for the 'create table <tableName> ( ' command.
 void testDataType()
          Test of the options for the 'create table t2(c1' command.
 void testDoubleSpace()
          The string with two spaces returns a string empty.
 void testEmptyString1()
          Empty string as a command gives also a completed phrase empty.
 void testEmptyString2()
          Empty string as a command gives a set of options different to zero.
 void testEmptyString3()
          An empty string does not have several way of phrases.
 void testInvalidCommand1()
          Invalid, no options.
 void testInvalidCommand2()
          Invalid, no options.
 void testNullAnswerReplacetoken()
          Tries to add a null answer.
 void testNullPhrase()
          Tests that a phrase cannot be null.
 void testNullPhraseReplacetoken()
          Tries to add a null phrase.
 void testNullTokenInTokensReplacetoken()
          Tries to add a null in the list of tokens.
 void testNullTokensReplacetoken()
          Tries to add a null list of tokens.
 void testPrecision()
          Test of the options for the 'create table t1 (c1 int, c2 char(' command.
 void testSecondColumn()
          Test of the options for the 'create table t2(c1 int,' command.
 void testSeveralOptionsAfterColumn()
          Test of the options for the 'create table t1 (c1 int, c2 char(10)' command.
 void testSpace1()
          The string with just one space returns a string empty.
 void testSpace2()
          The string with just one space returns a string with one space also.
 void testSpace3()
          An space does not have several ways of phrases.
 void testValidCommand1()
          Test of the options for the 'create table t1 (c1 int)' command.
 void testValidCommand2()
          Test of the options for the 'create table t1 (c1 int, c2 char(10))' command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImplementationLexicalAnalyzerTest

public ImplementationLexicalAnalyzerTest()
Default constructor.

Method Detail

setUpBeforeClass

public static void setUpBeforeClass()
                             throws AbstractDB2SAException
Load the graph.

Throws:
AbstractDB2SAException - Never

tearDownAfterClass

public static void tearDownAfterClass()
Clears the configuration file name property at the end of the test.


testCloseFirstParenthesis

public void testCloseFirstParenthesis()
                               throws AbstractDB2SAException
Test of the options for the 'create table t1 (c1 int, c2 char(10' command.

Throws:
AbstractDB2SAException - Never.

testComma

public void testComma()
               throws AbstractDB2SAException
Test of the options for the 'create table t2(c1 int' command.

Throws:
AbstractDB2SAException - Never.

testConvertionCrea

public void testConvertionCrea()
                        throws AbstractDB2SAException
Tests the token conversion.

Throws:
AbstractDB2SAException - Never.

testConvertionCreateTab

public void testConvertionCreateTab()
                             throws AbstractDB2SAException
Tests the token conversion 'create tab' -> 'create tab'.

Throws:
AbstractDB2SAException - Never.

testCreaPhrase1

public void testCreaPhrase1()
                     throws AbstractDB2SAException
Test to complete the phrase crea (phrase).

Throws:
AbstractDB2SAException - Never.

testCreaPhrase2

public void testCreaPhrase2()
                     throws AbstractDB2SAException
Test to complete the phrase crea (options).

Throws:
AbstractDB2SAException - Never.

testCreaPhrase3

public void testCreaPhrase3()
                     throws AbstractDB2SAException
Test that the phrase 'crea' does not have several phrases.

Throws:
AbstractDB2SAException - Never.

testCreaPhrase4

public void testCreaPhrase4()
                     throws AbstractDB2SAException
Test to complete the phrase 'crea' (object).

Throws:
AbstractDB2SAException - Never.

testCreateCommand

public void testCreateCommand()
                       throws AbstractDB2SAException
Test of the options for the 'create' command. There is only one option.

Throws:
AbstractDB2SAException - Never.

testCreateTab

public void testCreateTab()
                   throws AbstractDB2SAException
Test the token completion tab -> table.

Throws:
AbstractDB2SAException - Never.

testCreateTableCommand1

public void testCreateTableCommand1()
                             throws AbstractDB2SAException
Test of the options for the 'create table' command. Test options.

Throws:
AbstractDB2SAException - Never.

testCreateTableCommand2

public void testCreateTableCommand2()
                             throws AbstractDB2SAException
Test of the options for the 'create table' command. Test phrases.

Throws:
AbstractDB2SAException - Never.

testCreateTableCommand3

public void testCreateTableCommand3()
                             throws AbstractDB2SAException
Test of the options for the 'create table' command. Phrase empty.

Throws:
AbstractDB2SAException - Never.

testCreateTableCommand4

public void testCreateTableCommand4()
                             throws AbstractDB2SAException
Test of the options for the 'create table' command.

Throws:
AbstractDB2SAException - Never.

testCreateTableCommand4WithSpace

public void testCreateTableCommand4WithSpace()
                                      throws AbstractDB2SAException
Test of the options for the 'create table ' command.

Throws:
AbstractDB2SAException - Never.

testCreateTableTableNameCommand

public void testCreateTableTableNameCommand()
                                     throws AbstractDB2SAException
Test of the options for the 'create table <tableName>' command.

Throws:
AbstractDB2SAException - Never.

testCTtnParenthesis

public void testCTtnParenthesis()
                         throws AbstractDB2SAException
Test of the options for the 'create table <tableName>(' command. Without space between tableName and command.

Throws:
AbstractDB2SAException - Never.

testCTtnSpaceParenthesis

public void testCTtnSpaceParenthesis()
                              throws AbstractDB2SAException
Test of the options for the 'create table <tableName> (' command. With space between tableName and command.

Throws:
AbstractDB2SAException - Never.

testCTtnSpaceParenthesisWithSpace

public void testCTtnSpaceParenthesisWithSpace()
                                       throws AbstractDB2SAException
Test of the options for the 'create table <tableName> ( ' command. With space between tableName and command.

Throws:
AbstractDB2SAException - Never.

testDataType

public void testDataType()
                  throws AbstractDB2SAException
Test of the options for the 'create table t2(c1' command.

Throws:
AbstractDB2SAException - Never.

testEmptyString1

public void testEmptyString1()
                      throws AbstractDB2SAException
Empty string as a command gives also a completed phrase empty.

Throws:
AbstractDB2SAException - Never

testEmptyString2

public void testEmptyString2()
                      throws AbstractDB2SAException
Empty string as a command gives a set of options different to zero. At least, the grammar has to have one option.

If the grammar was not defined is it possible to return zero options, however this is not a normal case.

Throws:
AbstractDB2SAException - Never.

testEmptyString3

public void testEmptyString3()
                      throws AbstractDB2SAException
An empty string does not have several way of phrases.

Throws:
AbstractDB2SAException - Never.

testInvalidCommand1

public void testInvalidCommand1()
                         throws AbstractDB2SAException
Invalid, no options.

Throws:
AbstractDB2SAException - Never.

testInvalidCommand2

public void testInvalidCommand2()
                         throws AbstractDB2SAException
Invalid, no options.

Throws:
AbstractDB2SAException - Never.

testNullAnswerReplacetoken

public void testNullAnswerReplacetoken()
                                throws AbstractDB2SAException
Tries to add a null answer.

Throws:
AbstractDB2SAException - Never.

testNullPhrase

public void testNullPhrase()
                    throws AbstractDB2SAException
Tests that a phrase cannot be null.

Throws:
AbstractDB2SAException - Never.

testNullPhraseReplacetoken

public void testNullPhraseReplacetoken()
                                throws AbstractDB2SAException
Tries to add a null phrase.

Throws:
AbstractDB2SAException - Never.

testNullTokenInTokensReplacetoken

public void testNullTokenInTokensReplacetoken()
                                       throws AbstractDB2SAException
Tries to add a null in the list of tokens.

Throws:
AbstractDB2SAException - Never.

testNullTokensReplacetoken

public void testNullTokensReplacetoken()
                                throws AbstractDB2SAException
Tries to add a null list of tokens.

Throws:
AbstractDB2SAException - Never.

testPrecision

public void testPrecision()
                   throws AbstractDB2SAException
Test of the options for the 'create table t1 (c1 int, c2 char(' command.

Throws:
AbstractDB2SAException - Never.

testSecondColumn

public void testSecondColumn()
                      throws AbstractDB2SAException
Test of the options for the 'create table t2(c1 int,' command.

Throws:
AbstractDB2SAException - Never.

testSeveralOptionsAfterColumn

public void testSeveralOptionsAfterColumn()
                                   throws AbstractDB2SAException
Test of the options for the 'create table t1 (c1 int, c2 char(10)' command.

Throws:
AbstractDB2SAException - Never.

testSpace1

public void testSpace1()
                throws AbstractDB2SAException
The string with just one space returns a string empty.

Throws:
AbstractDB2SAException - Never.

testDoubleSpace

public void testDoubleSpace()
                     throws AbstractDB2SAException
The string with two spaces returns a string empty.

Throws:
AbstractDB2SAException - Never.

testSpace2

public void testSpace2()
                throws AbstractDB2SAException
The string with just one space returns a string with one space also.

Throws:
AbstractDB2SAException - Never.

testSpace3

public void testSpace3()
                throws AbstractDB2SAException
An space does not have several ways of phrases.

Throws:
AbstractDB2SAException - Never.

testValidCommand1

public void testValidCommand1()
                       throws AbstractDB2SAException
Test of the options for the 'create table t1 (c1 int)' command.

Throws:
AbstractDB2SAException - Never.

testValidCommand2

public void testValidCommand2()
                       throws AbstractDB2SAException
Test of the options for the 'create table t1 (c1 int, c2 char(10))' command.

Throws:
AbstractDB2SAException - Never.


Andres Gomez Casanova (AngocA) 2009-2010 Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.