> it looks like some static fields in LTC aren't being initialized. If your code is executed within a static initializer then these fields won't be initialized. Like Chris said -- post the full stack trace and, ideally, a short snippet of code demonstrating what you're doing (or trying to do).
> I can't extend LTC because my fixtures already need to extend JUnit's 'Rule' > class for JUnit to know how to use them This isn't true. Your suite class can extend LTC and you can add additional rules within that class. You probably mean something else -- be specific, provide code examples. Dawid On Wed, Nov 12, 2014 at 4:06 PM, Jason Gerlowski <[email protected]> wrote: > 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). --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
