use of com.example.graphql.client.betterbotz.orders.GetOrdersByValueQuery in project stargate by stargate.
the class ApolloTest method getOrdersByValue.
@Test
public void getOrdersByValue() throws ExecutionException, InterruptedException {
ApolloClient client = getApolloClient("/graphql/" + keyspace);
OrdersInput ordersInput = OrdersInput.builder().prodName("Medium Lift Arms").build();
GetOrdersByValueQuery query = GetOrdersByValueQuery.builder().value(ordersInput).build();
CompletableFuture<GetOrdersByValueQuery.Data> future = new CompletableFuture<>();
ApolloQueryCall<Optional<GetOrdersByValueQuery.Data>> observable = client.query(query);
observable.enqueue(queryCallback(future));
GetOrdersByValueQuery.Data result = future.get();
observable.cancel();
assertThat(result.getOrders()).isPresent();
GetOrdersByValueQuery.Orders orders = result.getOrders().get();
assertThat(orders.getValues()).isPresent();
List<GetOrdersByValueQuery.Value> valuesList = orders.getValues().get();
GetOrdersByValueQuery.Value value = valuesList.get(0);
assertThat(value.getId()).hasValue("792d0a56-bb46-4bc2-bc41-5f4a94a83da9");
assertThat(value.getProdId()).hasValue("31047029-2175-43ce-9fdd-b3d568b19bb2");
assertThat(value.getProdName()).hasValue("Medium Lift Arms");
assertThat(value.getCustomerName()).hasValue("Janice Evernathy");
assertThat(value.getAddress()).hasValue("2101 Everplace Ave 3116");
assertThat(value.getDescription()).hasValue("Ordering some more arms for my construction bot.");
assertThat(value.getPrice()).hasValue("3199.99");
assertThat(value.getSellPrice()).hasValue("3119.99");
}
Aggregations