public class MyEvictionListener extends DefaultEvictionListener
DefaultEvictionListener
to explicitly control when an
eviction notice is expected and to verify that eviction notices are received
as expected.Constructor and Description |
---|
MyEvictionListener() |
Modifier and Type | Method and Description |
---|---|
void |
assertEvicted()
Test for an eviction event.
|
void |
assertEvictionCount(int expected)
Test for the expected #of eviction notices to date.
|
void |
evicted(HardReferenceQueue<PO> queue,
PO ref) |
int |
getEvictionCount()
The #of eviction notices to date.
|
void |
setExpectedRef(PO ref)
Set the expected reference for the next eviction notice.
|
void |
setExpectedRefs(PO[] refs)
Set the next N expected references for eviction notices.
|
evicted
public void setExpectedRefs(PO[] refs)
refs
- The expected references.IllegalStateExecption
- unless there is no current expected reference.public void setExpectedRef(PO ref)
ref
- The expected reference or null to cause the listener to
throw an exception if a reference is evicted.public void assertEvicted()
junit.framework.AssertionFailedError
- if nothing was evicted since the last time an expected
eviction reference was set.public void assertEvictionCount(int expected)
expected
- public int getEvictionCount()
public void evicted(HardReferenceQueue<PO> queue, PO ref)
junit.framework.AssertionFailedError
- if the evicted reference is not the next expected
eviction reference or if no eviction is expected.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.