@Test void testOptionalExceptionResultReturnsTheExceptionAsAsInsertedThroughTheQueryResponseMessage() { IllegalArgumentException expectedException = new IllegalArgumentException("some-exception"); QueryResponseMessage<TestQueryResponse> testQueryResponseMessage = GenericQueryResponseMessage.asResponseMessage(TestQueryResponse.class, expectedException); QueryResponse testQueryResponse = querySerializer.serializeResponse(testQueryResponseMessage, REQUEST_MESSAGE_ID); GrpcBackedResponseMessage<TestQueryResponse> testSubject = new GrpcBackedResponseMessage<>(testQueryResponse, serializer); Optional<Throwable> result = testSubject.optionalExceptionResult(); assertTrue(result.isPresent()); assertEquals(expectedException.getMessage(), result.get().getMessage()); }
@Override public Optional<Throwable> optionalExceptionResult() { return Optional.ofNullable(exception); }
GrpcBackedResponseMessage implements QueryResponseMessage<R> { @Override public Optional<Throwable> optionalExceptionResult() { return Optional.ofNullable(exception); } }
GrpcBackedResponseMessage implements QueryResponseMessage<R> { @Override public Optional<Throwable> optionalExceptionResult() { return Optional.ofNullable(exception); } GrpcBackedResponseMessage(QueryResponse queryResponse, Serializer serializer); private  GrpcBackedResponseMessage(QueryResponse queryResponse,
                                      LazyDeserializingObject<R> serializedPayload,
                                      Throwable exception,
                                      Supplier<MetaData> metaDataSupplier); }
GrpcBackedResponseMessage implements QueryResponseMessage<R> { @Override public Optional<Throwable> optionalExceptionResult() { return Optional.ofNullable(exception); } GrpcBackedResponseMessage(QueryResponse queryResponse, Serializer serializer); private  GrpcBackedResponseMessage(QueryResponse queryResponse,
                                      LazyDeserializingObject<R> serializedPayload,
                                      Throwable exception,
                                      Supplier<MetaData> metaDataSupplier); @Override String getIdentifier(); @Override MetaData getMetaData(); @Override R getPayload(); @Override Class<R> getPayloadType(); @Override boolean isExceptional(); @Override Optional<Throwable> optionalExceptionResult(); @Override GrpcBackedResponseMessage<R> withMetaData(Map<String, ?> metaData); @Override GrpcBackedResponseMessage<R> andMetaData(Map<String, ?> metaData); }
GrpcBackedResponseMessage implements QueryResponseMessage<R> { @Override public Optional<Throwable> optionalExceptionResult() { return Optional.ofNullable(exception); } GrpcBackedResponseMessage(QueryResponse queryResponse, Serializer serializer); private  GrpcBackedResponseMessage(QueryResponse queryResponse,
                                      LazyDeserializingObject<R> serializedPayload,
                                      Throwable exception,
                                      Supplier<MetaData> metaDataSupplier); @Override String getIdentifier(); @Override MetaData getMetaData(); @Override R getPayload(); @Override Class<R> getPayloadType(); @Override boolean isExceptional(); @Override Optional<Throwable> optionalExceptionResult(); @Override GrpcBackedResponseMessage<R> withMetaData(Map<String, ?> metaData); @Override GrpcBackedResponseMessage<R> andMetaData(Map<String, ?> metaData);  }