Hi all,

I'm seeing NPE's when calling static methods on LuceneTestCase (without
extending it).

I'm trying to write tests for a few classes that interact with Lucene.  To
do that, I was trying to create JUnit @Rule (
https://github.com/junit-team/junit/wiki/Rules) fixtures that I can share
across different test classes.  I want these fixtures to use the
randomness/extra-checks found in LuceneTestCase, but I can't extend LTC
because my fixtures already need to extend JUnit's 'Rule' class for JUnit
to know how to use them.

So instead I wrote the fixtures to access LTC functionality though the
class's static methods (LTC.newDirectory(), LTC.newSearcher(), etc.)

Is this a valid way to access LTC methods?  Is there any special
initialization I need to do before using the class in this way?

I ask because I've started to see a few occasional NPE's in LTC during
tests that use these fixtures.  To an amateur, it looks like some static
fields in LTC aren't being initialized.  It's hard to tell whether I should
consider this a bug in the class, or whether I'm using it incorrectly.

Thanks for any help/insight you can offer!

Best,

Jason Gerlowski


(I can follow-up with code-snippets that reproduce this issue.  I didn't
post them in this email because I thought I might just be misusing
LuceneTestCase).

Reply via email to