com.google.web.bindery.requestfactory.gwt.client.testing

## 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 edited
    `E` - 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 of `RequestFactoryEditorDriver` that records its inputs.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MockRequestFactoryEditorDriver()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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()` Returns `null` or the last value recorded.
    `E` | `getEditor()` Returns `null` or the last value recorded.
    `java.util.List<EditorError>` | `getErrors()` Returns an empty list.
    `EventBus` | `getEventBus()` Returns `null` or the last value recorded.
    `java.lang.String[]` | `getPaths()` Returns a zero-length array.
    `P` | `getProxy()` Returns `null` or the last value recorded.
    `RequestFactory` | `getRequestFactory()` Returns `null` or the last value recorded.
    `RequestContext` | `getSaveRequest()` Returns `null` or the last value recorded.
    `boolean` | `hasErrors()` Returns `false`.
    `void` | `initialize(E editor)` Initializes a driver that will not be able to support subscriptions.
    `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.
    `boolean` | `isDirty()` Returns `false`.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MockRequestFactoryEditorDriver

          public MockRequestFactoryEditorDriver()

  - ### Method Detail

    - #### accept

          public void accept(EditorVisitor visitor)

      A no-op method.
      Specified by:
        `accept` in interface `EditorDriver<RequestContext>`

    - #### display

          public void display(P proxy)

      Records its arguments.
      Specified by:
        `display` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `proxy` - a Proxy of type P

    - #### edit

          public void edit(P proxy,
                  RequestContext saveRequest)

      Records its arguments.
      Specified by:
        `edit` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `proxy` - the proxy to be edited
        `saveRequest` - the request context that will accumulate edits and is returned form `RequestFactoryEditorDriver.flush()`

    - #### flush

          public RequestContext flush()

      Returns `null` or the last value recorded.
      Specified by:
        `flush` in interface `EditorDriver<RequestContext>`
      Specified by:
        `flush` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Returns:
        the RequestContext passed into `RequestFactoryEditorDriver.edit(Object, RequestContext)`

    - #### getEditor

          public E getEditor()

      Returns `null` or the last value recorded.

    - #### getErrors

          public java.util.List<EditorError> getErrors()

      Returns an empty list.
      Specified by:
        `getErrors` in interface `EditorDriver<RequestContext>`
      Returns:
        a List of `EditorError` instances

    - #### getEventBus

          public EventBus getEventBus()

      Returns `null` or the last value recorded.

    - #### getPaths

          public java.lang.String[] getPaths()

      Returns a zero-length array.
      Specified by:
        `getPaths` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Returns:
        an array of Strings

    - #### getProxy

          public P getProxy()

      Returns `null` or the last value recorded.

    - #### getRequestFactory

          public RequestFactory getRequestFactory()

      Returns `null` or the last value recorded.

    - #### getSaveRequest

          public RequestContext getSaveRequest()

      Returns `null` or the last value recorded.

    - #### hasErrors

          public boolean hasErrors()

      Returns `false`.
      Specified by:
        `hasErrors` in interface `EditorDriver<RequestContext>`
      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 to `EditorDelegate.subscribe()` will do nothing.
      Specified by:
        `initialize` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `editor` - an `Editor` of type E

    - #### initialize

          public void initialize(EventBus eventBus,
                        RequestFactory requestFactory,
                        E editor)

      Records its arguments.
      Specified by:
        `initialize` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `eventBus` - the `EventBus`
        `requestFactory` - a `RequestFactory` instance
        `editor` - an `Editor` 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 interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `requestFactory` - a `RequestFactory` instance
        `editor` - an `Editor` of type E
      See Also:
        `EditorDelegate.subscribe()`

    - #### isDirty

          public boolean isDirty()

      Returns `false`.
      Specified by:
        `isDirty` in interface `EditorDriver<RequestContext>`
      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 interface `EditorDriver<RequestContext>`
      Parameters:
        `violations` - an Iterable over `ConstraintViolation` instances
      Returns:
        `true` if there were any unconsumed EditorErrors which can be retrieved from `EditorDriver.getErrors()`

    - #### setViolations

          public boolean setViolations(java.lang.Iterable<Violation> errors)

      A no-op method that always returns false.
      Specified by:
        `setViolations` in interface `RequestFactoryEditorDriver<P,E extends Editor<P>>`
      Parameters:
        `errors` - an Iterable over `Violation` instances
      Returns:
        `true` if there were any unconsumed EditorErrors which can be retrieved from `EditorDriver.getErrors()`