@Test void testConvertReturnsSingleResponseAsProvidedOptional() { QueryResponse testResponse = new QueryResponse(); Optional<QueryResponse> result = testSubject.convert(testResponse); assertTrue(result.isPresent()); assertEquals(testResponse, result.get()); }
@SuppressWarnings("unchecked") @Override public Optional<R> convert(Object response) { if (response instanceof Optional) { return (Optional<R>) response; } return Optional.ofNullable((R) expectedResponseType.cast(response)); }
OptionalResponseType extends AbstractResponseType<Optional<R>> { @SuppressWarnings("unchecked") @Override public Optional<R> convert(Object response) { if (response instanceof Optional) { return (Optional<R>) response; } return Optional.ofNullable((R) expectedResponseType.cast(response)); } }
OptionalResponseType extends AbstractResponseType<Optional<R>> { @SuppressWarnings("unchecked") @Override public Optional<R> convert(Object response) { if (response instanceof Optional) { return (Optional<R>) response; } return Optional.ofNullable((R) expectedResponseType.cast(response)); } @JsonCreator @ConstructorProperties({"expectedResponseType"})  OptionalResponseType(@JsonProperty("expectedResponseType") Class<R> expectedResponseType); }
OptionalResponseType extends AbstractResponseType<Optional<R>> { @SuppressWarnings("unchecked") @Override public Optional<R> convert(Object response) { if (response instanceof Optional) { return (Optional<R>) response; } return Optional.ofNullable((R) expectedResponseType.cast(response)); } @JsonCreator @ConstructorProperties({"expectedResponseType"})  OptionalResponseType(@JsonProperty("expectedResponseType") Class<R> expectedResponseType); @Override boolean matches(Type responseType); @SuppressWarnings("unchecked") @Override Optional<R> convert(Object response); @SuppressWarnings("unchecked") @Override Class responseMessagePayloadType(); @Override ResponseType<?> forSerialization(); @Override String toString(); }
OptionalResponseType extends AbstractResponseType<Optional<R>> { @SuppressWarnings("unchecked") @Override public Optional<R> convert(Object response) { if (response instanceof Optional) { return (Optional<R>) response; } return Optional.ofNullable((R) expectedResponseType.cast(response)); } @JsonCreator @ConstructorProperties({"expectedResponseType"})  OptionalResponseType(@JsonProperty("expectedResponseType") Class<R> expectedResponseType); @Override boolean matches(Type responseType); @SuppressWarnings("unchecked") @Override Optional<R> convert(Object response); @SuppressWarnings("unchecked") @Override Class responseMessagePayloadType(); @Override ResponseType<?> forSerialization(); @Override String toString();  }