Ravinder Reddy wrote:

    dear all,

assertSQLState() method takes 2 parameters out of which is one expected SQLState and Other is the Exception.how to handle this while it is uncommon to catch exceptions in JUnit.? I am struggling in finding out the expected SQLStates for each SQL statement(group of sql statements) as the test (declareGlobalTempTableJava.java) has too many tests(nearly 2000 lines of code).
        Thank U.
Typically the SQLState is printed in the canon file, which in this case would be functionTests/master/declareGlobalTempTableJava.out, but I see in this case they are not. You can do one of two things to get the SQLStates. You can change the old test to catch SQLExceptions instead of Throwables and print out the sqlstates, so instead of System.out.println("Expected message: "+ e.getMessage()); you would have System.out.println("Expected message: "+ e.getSQLState() +":" + e.getMessage());

Then run it and look at the .out file.

or

You can put temporary System.out.println("Expected message: "+ e.getSQLState() +":" + e.getMessage()); statements in the new test, run it and see what the SQLStates are.

Both are really brute force but the only ideas that I have.

Kathey


Reply via email to