com.google.web.bindery.requestfactory.shared.testing

## Class FakeRequestFactory

- java.lang.Object
- - com.google.web.bindery.requestfactory.shared.testing.FakeRequestFactory

- All Implemented Interfaces:
    RequestFactory

      public class FakeRequestFactory
      extends java.lang.Object
      implements RequestFactory

  A no-op implementation of `RequestFactory` that can be used for building mocks.

- - ### Field Summary

    - ### Fields inherited from interface com.google.web.bindery.requestfactory.shared.RequestFactory

      `JSON_CONTENT_TYPE_UTF8`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FakeRequestFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<P extends EntityProxy> Request<P>` | `find(EntityProxyId<P> proxyId)` Returns `null`.
    `EventBus` | `getEventBus()` Returns the last value passed to `initialize(EventBus, RequestTransport)`.
    `java.lang.String` | `getHistoryToken(java.lang.Class<? extends EntityProxy> clazz)` Returns `null`.
    `java.lang.String` | `getHistoryToken(EntityProxyId<?> proxy)` Returns `null`.
    `java.lang.Class<? extends EntityProxy>` | `getProxyClass(java.lang.String historyToken)` Returns `null`.
    `<T extends EntityProxy> EntityProxyId<T>` | `getProxyId(java.lang.String historyToken)` Returns `null`.
    `RequestTransport` | `getRequestTransport()` Returns the last value passed to `initialize(EventBus, RequestTransport)`.
    `ProxySerializer` | `getSerializer(ProxyStore store)` Returns `null`.
    `void` | `initialize(EventBus eventBus)` Equivalent to `initialize(eventBus, new FakeRequestTransport())`.
    `void` | `initialize(EventBus eventBus, RequestTransport transport)` Saves the parameters for later retrieval.

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

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

- - ### Constructor Detail

    - #### FakeRequestFactory

          public FakeRequestFactory()

  - ### Method Detail

    - #### find

          public <P extends EntityProxy> Request<P> find(EntityProxyId<P> proxyId)

      Returns `null`.
      Specified by:
        `find` in interface `RequestFactory`
      Parameters:
        `proxyId` - an `EntityProxyId` instance of type P
      Returns:
        a `Request` object
      See Also:
        `RequestContext.find(EntityProxyId)`

    - #### getEventBus

          public EventBus getEventBus()

      Returns the last value passed to `initialize(EventBus, RequestTransport)`.
      Specified by:
        `getEventBus` in interface `RequestFactory`
      Returns:
        the `EventBus` associated with this instance

    - #### getHistoryToken

          public java.lang.String getHistoryToken(java.lang.Class<? extends EntityProxy> clazz)

      Returns `null`.
      Specified by:
        `getHistoryToken` in interface `RequestFactory`
      Parameters:
        `clazz` - a Class object for an `EntityProxy` subclass
      Returns:
        a `History` compatible token

    - #### getHistoryToken

          public java.lang.String getHistoryToken(EntityProxyId<?> proxy)

      Returns `null`.
      Specified by:
        `getHistoryToken` in interface `RequestFactory`
      Parameters:
        `proxy` - an `EntityProxyId` instance
      Returns:
        a `History` compatible token

    - #### getProxyClass

          public java.lang.Class<? extends EntityProxy> getProxyClass(java.lang.String historyToken)

      Returns `null`.
      Specified by:
        `getProxyClass` in interface `RequestFactory`
      Parameters:
        `historyToken` - a String token
      Returns:
        a Class object for an `EntityProxy` subclass

    - #### getProxyId

          public <T extends EntityProxy> EntityProxyId<T> getProxyId(java.lang.String historyToken)

      Returns `null`.
      Specified by:
        `getProxyId` in interface `RequestFactory`
      Parameters:
        `historyToken` - a String token
      Returns:
        an `EntityProxyId`

    - #### getRequestTransport

          public RequestTransport getRequestTransport()

      Returns the last value passed to `initialize(EventBus, RequestTransport)`.
      Specified by:
        `getRequestTransport` in interface `RequestFactory`
      Returns:
        the `RequestTransport` associated with this instance

    - #### getSerializer

          public ProxySerializer getSerializer(ProxyStore store)

      Returns `null`.
      Specified by:
        `getSerializer` in interface `RequestFactory`
      Parameters:
        `store` - a helper object for the ProxySerializer to provide low-level storage access
      Returns:
        a new ProxySerializer
      See Also:
        `DefaultProxyStore`

    - #### initialize

          public void initialize(EventBus eventBus)

      Equivalent to `initialize(eventBus, new FakeRequestTransport())`.
      Specified by:
        `initialize` in interface `RequestFactory`
      Parameters:
        `eventBus` - an `EventBus`

    - #### initialize

          public void initialize(EventBus eventBus,
                                 RequestTransport transport)

      Saves the parameters for later retrieval.
      Specified by:
        `initialize` in interface `RequestFactory`
      Parameters:
        `eventBus` - an `EventBus`
        `transport` - a `RequestTransport` instance