org.easymock

Class Capture<T>

public class Capture<T> extends Object implements Serializable

Will contain what was captured by the capture() matcher. Knows if something was captured or not (allows to capture a null value).

Parameters: Type of the captured element

Constructor Summary
Capture()
Default constructor.
Capture(CaptureType type)
Constructor allowing to select the capture type
Method Summary
TgetValue()
Return captured value
List<T>getValues()
Return all captured values.
booleanhasCaptured()
voidreset()
Will reset capture to a "nothing captured yet" state
voidsetValue(T value)
Used internally by the EasyMock framework to add a new captured value

Constructor Detail

Capture

public Capture()
Default constructor. Only the last element will be captured

Capture

public Capture(CaptureType type)
Constructor allowing to select the capture type

Parameters: type capture type

Method Detail

getValue

public T getValue()
Return captured value

Returns: The last captured value

Throws: AssertionError if nothing was captured yet or if more than one value was captured

getValues

public List<T> getValues()
Return all captured values. It returns the actual list so you can modify it's content if needed

Returns: The currently captured values

hasCaptured

public boolean hasCaptured()

Returns: true if something was captured

reset

public void reset()
Will reset capture to a "nothing captured yet" state

setValue

public void setValue(T value)
Used internally by the EasyMock framework to add a new captured value

Parameters: value Value captured

Copyright © 2001-2009 OFFIS, Tammo Freese, Henri Tremblay. This documentation is provided under the terms of the MIT licence.]]>