[ http://issues.apache.org/jira/browse/DERBY-919?page=all ]

Kristian Waagan updated DERBY-919:
----------------------------------

    Attachment: BaseJUnitTestClasses-v2.tar

Thank you Andreas. See answers for your comments below.

1. I don't think this is necessary. An exception there merely implies we are in 
a JSR 169 environment, and that's all the static code is used for. If running 
under JSR 169, I would not like to see an exception being printed when running 
tests. I would then belive something was wrong, but it is not. And, if you are 
unable to load Driver in a non JSR 169 environment, then something is very 
wrong with the environment and the code will fail elsewhere.

2. Thanks for catching this. Forgot to remove while debugging privilege 
problems with the JCC driver.

3. I suggest you add this to the Jira issue I will create for tracking 
improvemens and bug for the JUnit base classes.

Uploaded 'BaseJUnitTestClasses-v2-tar' which fixes 2. and  a missing @throws 
tag.

> improve pattern for setting up junit tests
> ------------------------------------------
>
>          Key: DERBY-919
>          URL: http://issues.apache.org/jira/browse/DERBY-919
>      Project: Derby
>         Type: Sub-task
>   Components: Test
>  Environment: All
>     Reporter: Andreas Korneliussen
>     Assignee: Kristian Waagan
>  Attachments: BaseJUnitTestClasses-v1.tar, BaseJUnitTestClasses-v2.tar, 
> BasicDerbyJUnitTest.html, BasicDerbyJUnitTest.java, 
> BasicDerbyJUnitTestTest.java, JDBCClient.java, TestConfiguration.java
>
> The current junit tests cannot be run directly from the java.ui.textrunner by 
> i.e using:
> java junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.tests.junitTests.lang.BooleanTest
> .E
> Time: 0.008
> There was 1 error:
> 1) 
> testBoolean(org.apache.derbyTesting.functionTests.tests.junitTests.lang.BooleanTest)java.lang.NullPointerException
>         at 
> org.apache.derbyTesting.functionTests.util.DerbyJUnitTest.faultInDriver(DerbyJUnitTest.java:317)
>         at 
> org.apache.derbyTesting.functionTests.util.DerbyJUnitTest.getConnection(DerbyJUnitTest.java:345)
>         at 
> org.apache.derbyTesting.functionTests.util.DerbyJUnitTest.getConnection(DerbyJUnitTest.java:335)
>         at 
> org.apache.derbyTesting.functionTests.tests.junitTests.lang.BooleanTest.testBoolean(BooleanTest.java:136)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> FAILURES!!!
> Tests run: 1,  Failures: 0,  Errors: 1
> The reason is that the tests needs to have some fixture being set up before 
> the test can run, and that this is currently supported by calling a bunch of 
> static methods in the correct order to initialize some static members of 
> DerbyJUnitTest.
> The proposed alternative is that the added fixture is set up in the suite() 
> method, which is used by JUnit to get the Test object to be run.

-- 
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