db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre.Tjeldv...@Sun.COM
Subject Re: JUnit problem
Date Wed, 05 Dec 2007 09:14:49 GMT
Dyre.Tjeldvoll@Sun.COM writes:

> Daniel John Debrunner <djd@apache.org> writes:
>> Does this help:
>> http://wiki.apache.org/db-derby/DerbyJunitTestConfiguration
>> Basically you need to define in the suite method how you want your
>> test fixtures to be run. There is no outside agent at setup time
>> saying it's running in "client" or "embedded" mode.
>> Once a fixture is running, then the usingDerbyNetClient() methods make
>> sense, they indicate a fixture is running in that mode.
> Ok, thanks Dan and Knut. I think I understand. The strange thing,
> however, is that I more or less copied this from ProcedureTest.java:
>     private static Test baseSuite(String name)
>     {
>         TestSuite suite = new TestSuite(name);
>         // Need JDBC 2 DriverManager to run these tests
>         if (JDBC.vmSupportsJDBC2()) {        	
>         suite.addTestSuite(ProcedureTest.class);
>         if (!usingDerbyNet()) {
>             suite.addTest
>                 (new ProcedureTest
>                  ("xtestExecuteUpdateWithNoDynamicResultSets"));
>             suite.addTest
>                 (new ProcedureTest
>                  ("xtestExecuteUpdateWithNoDynamicResultSets_prepared"));
>             suite.addTest
>                 (new ProcedureTest
>                  ("xtestExecuteUpdateWithOneDynamicResultSet_prepared"));
> ...

Actually, I just ran this test and it turns out that this doesn't work
either. The x test cases ARE in fact run in both modes. Hrmpf...

Is there a way of making the usingX predicates throw an exception or
something when they are invoked outside a proper test case? Ideally
there would be a way of rejecting such usage at compile time...

I just tried making them non-static, but that won't work since they
are used in a bunch of static utilities. Oh well, that's life...


View raw message