[ 
http://issues.apache.org/jira/browse/DERBY-1162?page=comments#action_12372258 ] 

Daniel John Debrunner commented on DERBY-1162:
----------------------------------------------

SQLStates are always five characters so I'm not sure why the method needs to 
truncate the expected value.

>From the comments in the description it seems as though you are expecting 
>tests should use constants from the engine's SQLState.
That is not good practice, it is not part of the public api and it can lead to 
hidden bugs.

If a test is checking for SQLState.SOME_ERROR in a test, then if a error in 
coding changes that, say from a SQL Standard 23001 error
to 2E001 then the test will continue to pass, even though a bug was introduced.

> Add mechanism to assert/compare SQLStates
> -----------------------------------------
>
>          Key: DERBY-1162
>          URL: http://issues.apache.org/jira/browse/DERBY-1162
>      Project: Derby
>         Type: Sub-task
>   Components: Test
>     Versions: 10.2.0.0
>  Environment: JUnit test environment
>     Reporter: Kristian Waagan
>     Assignee: Kristian Waagan
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-1162-1a.diff
>
> The JUnit test environment needs a mechanism to assert/compare SQLStates. The 
> goal is to be able to reference states from SQLState without having to care 
> if the length of the identifier is 5,7 or more characters long.
> A way to do this already exist in 
> StandardException.getSQLStateFromIdentifier, but it is too unwieldy and long. 
> I suggest adding  'assertSQLState(String, String, SQLException)' method to 
> BaseJDBCTestCase.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to