Back to Top

Monday, February 02, 2009

Random Java blogging

From the JUnit FAQ:

Each test runs in its own test fixture to isolate tests from the changes made by other tests. That is, tests don't share the state of objects in the test fixture. Because the tests are isolated, they can be run in any order.

Very important to keep in mind if you are using static resources in your tests. Also, the documentation doesn’t explicitly say so, but it seems that the tests are run on a single thread.

Starting from Java 5 you can modify final fields using reflection. Then again, you can do a lot of weird things using reflection and you shouldn’t be surprised if some things break (however, reflection can be very useful for testing code which wasn’t written with testability in mind).

Javaparser - “A Java 1.5 Parser with AST generation and visitor support”. Very cool, even though it is Java 1.5 only. SUN exposed the compiler in 1.6, but AFAIK they didn’t expose the parser.

0 comments:

Post a Comment

You can use some HTML tags, such as <b>, <i>, <a>. Comments are moderated, so there will be a delay until the comment appears. However if you comment, I follow.