use of com.example.graphql.client.betterbotz.products.DeleteProductsMutation in project stargate by stargate.
the class ApolloTestBase method cleanupProduct.
private DeleteProductsMutation.Data cleanupProduct(ApolloClient client, Object productId) {
DeleteProductsMutation mutation = DeleteProductsMutation.builder().value(ProductsInput.builder().id(productId).build()).build();
DeleteProductsMutation.Data result = getObservable(client.mutate(mutation));
return result;
}
use of com.example.graphql.client.betterbotz.products.DeleteProductsMutation in project stargate by stargate.
the class ApolloTest method deleteProducts.
@Test
public void deleteProducts() {
ApolloClient client = getApolloClient("/graphql/" + keyspace);
String productId = UUID.randomUUID().toString();
ProductsInput insertInput = ProductsInput.builder().id(productId).name("Shiny Legs").price("3199.99").created(now()).description("Normal legs but shiny.").build();
insertProduct(client, insertInput);
DeleteProductsMutation mutation = DeleteProductsMutation.builder().value(ProductsInput.builder().id(productId).build()).build();
DeleteProductsMutation.Data result = getObservable(client.mutate(mutation));
assertThat(result.getDeleteProducts()).hasValueSatisfying(deleteProducts -> {
assertThat(deleteProducts.getApplied()).hasValue(true);
assertThat(deleteProducts.getValue()).hasValueSatisfying(product -> {
assertThat(product.getId()).hasValue(productId);
assertThat(product.getName()).isEmpty();
assertThat(product.getPrice()).isEmpty();
assertThat(product.getCreated()).isEmpty();
assertThat(product.getDescription()).isEmpty();
});
});
List<Value> remainingProductValues = getProductValues(client, productId);
assertThat(remainingProductValues).isEmpty();
}
use of com.example.graphql.client.betterbotz.products.DeleteProductsMutation in project stargate by stargate.
the class ApolloTest method deleteProductsIfExistsTrue.
@Test
public void deleteProductsIfExistsTrue() {
ApolloClient client = getApolloClient("/graphql/" + keyspace);
String productId = UUID.randomUUID().toString();
ProductsInput insertInput = ProductsInput.builder().id(productId).name("Shiny Legs").price("3199.99").created(now()).description("Normal legs but shiny.").build();
insertProduct(client, insertInput);
ProductsInput deleteInput = ProductsInput.builder().id(productId).name(insertInput.name()).price(insertInput.price()).created(insertInput.created()).build();
DeleteProductsMutation mutation = DeleteProductsMutation.builder().value(deleteInput).ifExists(true).build();
DeleteProductsMutation.Data result = getObservable(client.mutate(mutation));
assertThat(result.getDeleteProducts()).hasValueSatisfying(deleteProducts -> {
assertThat(deleteProducts.getApplied()).hasValue(true);
});
}
Aggregations