org.apache.lucene.util
Class TestRuleFieldCacheSanity

java.lang.Object
  extended by org.apache.lucene.util.TestRuleFieldCacheSanity
All Implemented Interfaces:
org.junit.rules.TestRule

public class TestRuleFieldCacheSanity
extends Object
implements org.junit.rules.TestRule

This rule will fail the test if it has insane field caches.

calling assertSaneFieldCaches here isn't as useful as having test classes call it directly from the scope where the index readers are used, because they could be gc'ed just before this tearDown method is called.

But it's better then nothing.

If you are testing functionality that you know for a fact "violates" FieldCache sanity, then you should either explicitly call purgeFieldCache at the end of your test method, or refactor your Test class so that the inconsistent FieldCache usages are isolated in distinct test methods

See Also:
FieldCacheSanityChecker

Constructor Summary
TestRuleFieldCacheSanity()
           
 
Method Summary
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement s, Description d)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRuleFieldCacheSanity

public TestRuleFieldCacheSanity()
Method Detail

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement s,
                                               Description d)
Specified by:
apply in interface org.junit.rules.TestRule


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.