Class MockRequestFactoryEditorDriver<P,E extends Editor<P>>
- java.lang.Object
-
- com.google.web.bindery.requestfactory.gwt.client.testing.MockRequestFactoryEditorDriver<P,E>
-
- Type Parameters:
P
- the Proxy type being editedE
- the Editor type
- All Implemented Interfaces:
EditorDriver<RequestContext>
,RequestFactoryEditorDriver<P,E>
public class MockRequestFactoryEditorDriver<P,E extends Editor<P>> extends java.lang.Object implements RequestFactoryEditorDriver<P,E>
A no-op implementation ofRequestFactoryEditorDriver
that records its inputs.
-
-
Constructor Summary
Constructors Constructor Description MockRequestFactoryEditorDriver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(EditorVisitor visitor)
A no-op method.void
display(P proxy)
Records its arguments.void
edit(P proxy, RequestContext saveRequest)
Records its arguments.RequestContext
flush()
Returnsnull
or the last value recorded.E
getEditor()
Returnsnull
or the last value recorded.java.util.List<EditorError>
getErrors()
Returns an empty list.EventBus
getEventBus()
Returnsnull
or the last value recorded.java.lang.String[]
getPaths()
Returns a zero-length array.P
getProxy()
Returnsnull
or the last value recorded.RequestFactory
getRequestFactory()
Returnsnull
or the last value recorded.RequestContext
getSaveRequest()
Returnsnull
or the last value recorded.boolean
hasErrors()
Returnsfalse
.void
initialize(EventBus eventBus, RequestFactory requestFactory, E editor)
Records its arguments.void
initialize(RequestFactory requestFactory, E editor)
Initializes a driver with the editor it will run, and a RequestFactory to use for subscription services.void
initialize(E editor)
Initializes a driver that will not be able to support subscriptions.boolean
isDirty()
Returnsfalse
.boolean
setConstraintViolations(java.lang.Iterable<ConstraintViolation<?>> violations)
A no-op method that always returns false.boolean
setViolations(java.lang.Iterable<Violation> errors)
A no-op method that always returns false.
-
-
-
Method Detail
-
accept
public void accept(EditorVisitor visitor)
A no-op method.- Specified by:
accept
in interfaceEditorDriver<P>
-
display
public void display(P proxy)
Records its arguments.
-
edit
public void edit(P proxy, RequestContext saveRequest)
Records its arguments.- Specified by:
edit
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Parameters:
proxy
- the proxy to be editedsaveRequest
- the request context that will accumulate edits and is returned formRequestFactoryEditorDriver.flush()
-
flush
public RequestContext flush()
Returnsnull
or the last value recorded.- Specified by:
flush
in interfaceEditorDriver<P>
- Specified by:
flush
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Returns:
- the RequestContext passed into
RequestFactoryEditorDriver.edit(Object, RequestContext)
-
getEditor
public E getEditor()
Returnsnull
or the last value recorded.
-
getErrors
public java.util.List<EditorError> getErrors()
Returns an empty list.- Specified by:
getErrors
in interfaceEditorDriver<P>
- Returns:
- a List of
EditorError
instances
-
getEventBus
public EventBus getEventBus()
Returnsnull
or the last value recorded.
-
getPaths
public java.lang.String[] getPaths()
Returns a zero-length array.
-
getProxy
public P getProxy()
Returnsnull
or the last value recorded.
-
getRequestFactory
public RequestFactory getRequestFactory()
Returnsnull
or the last value recorded.
-
getSaveRequest
public RequestContext getSaveRequest()
Returnsnull
or the last value recorded.
-
hasErrors
public boolean hasErrors()
Returnsfalse
.- Specified by:
hasErrors
in interfaceEditorDriver<P>
- Returns:
true
if errors are present
-
initialize
public void initialize(E editor)
Description copied from interface:RequestFactoryEditorDriver
Initializes a driver that will not be able to support subscriptions. Calls toEditorDelegate.subscribe()
will do nothing.- Specified by:
initialize
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Parameters:
editor
- anEditor
of type E
-
initialize
public void initialize(EventBus eventBus, RequestFactory requestFactory, E editor)
Records its arguments.- Specified by:
initialize
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Parameters:
eventBus
- theEventBus
requestFactory
- aRequestFactory
instanceeditor
- anEditor
of type E- See Also:
EditorDelegate.subscribe()
,ResettableEventBus
-
initialize
public void initialize(RequestFactory requestFactory, E editor)
Description copied from interface:RequestFactoryEditorDriver
Initializes a driver with the editor it will run, and a RequestFactory to use for subscription services.- Specified by:
initialize
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Parameters:
requestFactory
- aRequestFactory
instanceeditor
- anEditor
of type E- See Also:
EditorDelegate.subscribe()
-
isDirty
public boolean isDirty()
Returnsfalse
.- Specified by:
isDirty
in interfaceEditorDriver<P>
- See Also:
EditorDelegate.setDirty(boolean)
-
setConstraintViolations
public boolean setConstraintViolations(java.lang.Iterable<ConstraintViolation<?>> violations)
A no-op method that always returns false.- Specified by:
setConstraintViolations
in interfaceEditorDriver<P>
- Parameters:
violations
- an Iterable overConstraintViolation
instances- Returns:
true
if there were any unconsumed EditorErrors which can be retrieved fromEditorDriver.getErrors()
-
setViolations
public boolean setViolations(java.lang.Iterable<Violation> errors)
A no-op method that always returns false.- Specified by:
setViolations
in interfaceRequestFactoryEditorDriver<P,E extends Editor<P>>
- Parameters:
errors
- an Iterable overViolation
instances- Returns:
true
if there were any unconsumed EditorErrors which can be retrieved fromEditorDriver.getErrors()
-
-