T
- Type of the captured elementpublic class Capture<T>
extends java.lang.Object
implements java.io.Serializable
capture()
matcher. Knows
if something was captured or not (allows to capture a null value).Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
private CaptureType |
type |
private java.util.List<T> |
values |
Modifier | Constructor and Description |
---|---|
private |
Capture()
Default constructor.
|
private |
Capture(CaptureType type)
Constructor allowing to select the capture type
|
Modifier and Type | Method and Description |
---|---|
T |
getValue()
Return captured value
|
java.util.List<T> |
getValues()
Return all captured values.
|
boolean |
hasCaptured() |
static <T> Capture<T> |
newInstance()
Create a new capture instance that will keep only the last captured value
|
static <T> Capture<T> |
newInstance(CaptureType type)
Create a new capture instance with a specific
CaptureType |
void |
reset()
Will reset capture to a "nothing captured yet" state
|
void |
setValue(T value)
Used internally by the EasyMock framework to add a new captured value
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final CaptureType type
private final java.util.List<T> values
private Capture()
private Capture(CaptureType type)
type
- capture typepublic static <T> Capture<T> newInstance()
T
- type of the class to be capturedpublic static <T> Capture<T> newInstance(CaptureType type)
CaptureType
T
- type of the class to be capturedtype
- capture type wantedpublic void reset()
public boolean hasCaptured()
public T getValue()
java.lang.AssertionError
- if nothing was captured yet or if more than one value was
capturedpublic java.util.List<T> getValues()
public void setValue(T value)
value
- Value capturedpublic java.lang.String toString()
toString
in class java.lang.Object