db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jayaram Subramanian <rsjay1...@gmail.com>
Subject Re: Validating failures during JUnit conversion
Date Tue, 12 Jan 2010 04:30:48 GMT
Thanks Bryan,
Also a small query.. I am running IJ.java to get the results and then get
them converted into JUNit.. I have started getting the following error when
trying to run the IJ..

ERROR XJ040: Failed to start database 'MyDbTest', see the next exception for

ERROR XSDB6: Another instance of Derby may have already booted the database
Am i missing something or should i have to reload the project in eclipse?

With Regards

On Mon, Jan 11, 2010 at 10:01 PM, Bryan Pendleton <bpendleton@amberpoint.com
> wrote:

>  When converting autoincrement.sql to JUnit, i have encountered a scenario
>> where i need to assert a failure... How can i do this?
> Hi Jayaram,
> One way to do this is to use this utility method, which issues the
> statement and expects to catch an error with a certain SQLState code:
>        assertStatementError("42Y62", st,
>                "alter table v2 add column c2 int");
> In your case, the actual statement that you issue would be different
> (it would be the CREATE TABLE statement that you expect to fail), and
> the actual error code would be different, as it would be the error
> that you expect, so it would be something like:
>        assertStatementError("428C1", st,
> "create table ai_multiple (i int,"+
> "a0 int generated always as identity (start with  -1,"+
> "increment by -1),"+
> "a1 smallint generated always as identity,"+
> "a2 int generated always as identity (start with  0),"+
> "a3 bigint generated always as identity (start with  -100,"+
> "increment by 10))");
> Hope this helps,
> bryan

View raw message