AbstractRpcInterceptor implements RpcInterceptor<A, R> { @Override public boolean canExecute(Action<?> action) { return getActionType().equals(action.getClass()); } protected  AbstractRpcInterceptor(Class<A> actionType); @Override boolean canExecute(Action<?> action); @Override Class<A> getActionType();  }
@Test public void typedAction_typeMatch_canExecute() { AbstractRpcInterceptor<TypedAction1, Result> interceptor = createInterceptor(TypedAction1.class); boolean canExecute = interceptor.canExecute(new TypedAction1()); assertTrue(canExecute); }
@Test public void typedAction_typeDoesntMatch_cannotExecute() { AbstractRpcInterceptor<TypedAction1, Result> interceptor = createInterceptor(TypedAction1.class); boolean canExecute = interceptor.canExecute(new TypedAction2()); assertFalse(canExecute); }