public class StaticFieldsInvariantRule
extends java.lang.Object
implements org.junit.rules.TestRule
TestRule that ensures static, reference fields of the suite class
(and optionally its superclasses) are cleaned up after a suite is completed.
This is helpful in finding out static memory leaks (a class references
something huge but is no longer used).ClassRule,
accept(Field)| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_LEAK_THRESHOLD |
| Constructor and Description |
|---|
StaticFieldsInvariantRule()
By default use
DEFAULT_LEAK_THRESHOLD as the threshold and count
in superclasses. |
StaticFieldsInvariantRule(long leakThresholdBytes,
boolean countSuperclasses) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept(java.lang.reflect.Field field) |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement s,
org.junit.runner.Description d) |
public static final long DEFAULT_LEAK_THRESHOLD
public StaticFieldsInvariantRule()
DEFAULT_LEAK_THRESHOLD as the threshold and count
in superclasses.public StaticFieldsInvariantRule(long leakThresholdBytes,
boolean countSuperclasses)
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement s,
org.junit.runner.Description d)
apply in interface org.junit.rules.TestRuleprotected boolean accept(java.lang.reflect.Field field)
false to exclude a given field from being
counted. By default final fields are rejected.Copyright © 2011–2018 Carrot Search s.c.. All rights reserved.