### Question:
AbstractClientConnector implements ClientConnector,
        MethodEventSource { protected <T extends ServerRpc> void registerRpc(T implementation, Class<T> rpcInterfaceType) { rpcManagerMap.put(rpcInterfaceType.getName(), new ServerRpcManager<T>( implementation, rpcInterfaceType)); }  @Override void addAttachListener(AttachListener listener); @Override void removeAttachListener(AttachListener listener); Flow<AttachEvent> attachEvents(); @Override void addDetachListener(DetachListener listener); @Override void removeDetachListener(DetachListener listener); Flow<DetachEvent> detachEvents(); @Deprecated @Override void requestRepaint(); @Override void markAsDirty(); @Override JsonObject encodeState(); @Override Class<? extends SharedState> getStateType(); @Override ServerRpcManager<?> getRpcManager(String rpcInterfaceName); @Override List<ClientMethodInvocation> retrievePendingRpcCalls(); @Override String getConnectorId(); @Override UI getUI(); @Override @Deprecated void requestRepaintAll(); @Override void markAsDirtyRecursive(); static Iterable<? extends ClientConnector> getAllChildrenIterable(
            final ClientConnector connector); @Override Collection<Extension> getExtensions(); @Override void removeExtension(Extension extension); @Override boolean isAttached(); @Override void attach(); @Override void detach(); @Override boolean isConnectorEnabled(); @Override void beforeClientResponse(boolean initial); @Override boolean handleConnectorRequest(VaadinRequest request,
            VaadinResponse response, String path); @Deprecated @Override void addListener(Class<?> eventType, Object target, Method method); @Override @Deprecated void removeListener(Class<?> eventType, Object target); @Override @Deprecated void removeListener(Class<?> eventType, Object target,
            Method method); @Deprecated Collection<?> getListeners(Class<?> eventType); @Override ErrorHandler getErrorHandler(); @Override void setErrorHandler(ErrorHandler errorHandler); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void registerRPCMultiInterfaceTest() { AbstractClientConnector mock = mock(AbstractClientConnector.class); MultiServerRpcMock implementation = new MultiServerRpcMock(); Mockito.doCallRealMethod().when(mock).registerRpc(implementation); try { mock.registerRpc(implementation); Assert.fail("expected exception"); } catch (Exception expected) { Assert.assertEquals( expected.getMessage(), "Use registerRpc(T implementation, Class<T> rpcInterfaceType) if the Rpc implementation implements more than one interface"); } }
@Test public void registerRPCInterfaceTest() { AbstractClientConnector mock = mock(AbstractClientConnector.class); ServerRpcMock implementation = new ServerRpcMock(); Mockito.doCallRealMethod().when(mock).registerRpc(implementation); mock.registerRpc(implementation); verify(mock, times(1)).registerRpc(implementation, ClickRpc.class); }
@Test public void registerRPCInterfaceLastTest() { AbstractClientConnector mock = mock(AbstractClientConnector.class); ServerRpcLastMock implementation = new ServerRpcLastMock(); Mockito.doCallRealMethod().when(mock).registerRpc(implementation); mock.registerRpc(implementation); verify(mock, times(1)).registerRpc(implementation, ClickRpc.class); }