@Test public void shouldNotSupplyBidiAnnotatedMethodWithWrongArgType() { BidirectionalMethodHandlerSupplier supplier = new BidirectionalMethodHandlerSupplier(); AnnotatedMethod method = getMethod("badArg", String.class); Service service = mock(Service.class); assertThrows(IllegalArgumentException.class, () -> supplier.get("foo", method, () -> service)); }
@Override public <ReqT, RespT> MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance) { if (!isRequiredMethodType(method)) { throw new IllegalArgumentException("Method not annotated as a bi-directional streaming method: " + method); } CallType type = determineCallType(method); MethodHandler<ReqT, RespT> handler; switch (type) { case bidiStreaming: handler = new BidiStreaming<>(methodName, method, instance); break; case unknown: default: throw new IllegalArgumentException("Not a supported bi-directional streaming method signature: " + method); } return handler; }
BidirectionalMethodHandlerSupplier extends AbstractMethodHandlerSupplier { @Override public <ReqT, RespT> MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance) { if (!isRequiredMethodType(method)) { throw new IllegalArgumentException("Method not annotated as a bi-directional streaming method: " + method); } CallType type = determineCallType(method); MethodHandler<ReqT, RespT> handler; switch (type) { case bidiStreaming: handler = new BidiStreaming<>(methodName, method, instance); break; case unknown: default: throw new IllegalArgumentException("Not a supported bi-directional streaming method signature: " + method); } return handler; } }
BidirectionalMethodHandlerSupplier extends AbstractMethodHandlerSupplier { @Override public <ReqT, RespT> MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance) { if (!isRequiredMethodType(method)) { throw new IllegalArgumentException("Method not annotated as a bi-directional streaming method: " + method); } CallType type = determineCallType(method); MethodHandler<ReqT, RespT> handler; switch (type) { case bidiStreaming: handler = new BidiStreaming<>(methodName, method, instance); break; case unknown: default: throw new IllegalArgumentException("Not a supported bi-directional streaming method signature: " + method); } return handler; } BidirectionalMethodHandlerSupplier(); }
BidirectionalMethodHandlerSupplier extends AbstractMethodHandlerSupplier { @Override public <ReqT, RespT> MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance) { if (!isRequiredMethodType(method)) { throw new IllegalArgumentException("Method not annotated as a bi-directional streaming method: " + method); } CallType type = determineCallType(method); MethodHandler<ReqT, RespT> handler; switch (type) { case bidiStreaming: handler = new BidiStreaming<>(methodName, method, instance); break; case unknown: default: throw new IllegalArgumentException("Not a supported bi-directional streaming method signature: " + method); } return handler; } BidirectionalMethodHandlerSupplier(); @Override boolean supplies(AnnotatedMethod method); @Override MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance); }
BidirectionalMethodHandlerSupplier extends AbstractMethodHandlerSupplier { @Override public <ReqT, RespT> MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance) { if (!isRequiredMethodType(method)) { throw new IllegalArgumentException("Method not annotated as a bi-directional streaming method: " + method); } CallType type = determineCallType(method); MethodHandler<ReqT, RespT> handler; switch (type) { case bidiStreaming: handler = new BidiStreaming<>(methodName, method, instance); break; case unknown: default: throw new IllegalArgumentException("Not a supported bi-directional streaming method signature: " + method); } return handler; } BidirectionalMethodHandlerSupplier(); @Override boolean supplies(AnnotatedMethod method); @Override MethodHandler<ReqT, RespT> get(String methodName, AnnotatedMethod method, Supplier<?> instance);  }