@Test public void execution2() throws Exception { withProduct(client(), product -> { final String slug = product.getMasterData().getStaged().getSlug().get(Locale.ENGLISH); final ProductProjectionQuery normalSphereRequest = ProductProjectionQuery.ofStaged() .withPredicates(m -> m.slug().locale(Locale.ENGLISH).is(slug)) .plusExpansionPaths(m -> m.productType()); final JsonNodeSphereRequest jsonNodeSphereRequest = JsonNodeSphereRequest.of(normalSphereRequest); assertThat(normalSphereRequest.httpRequestIntent()) .as("a JsonNodeSphereRequest creates the same request to the platform, but differs in the response") .isEqualTo(jsonNodeSphereRequest.httpRequestIntent()); final PagedQueryResult<ProductProjection> productProjectionPagedSearchResult = client().executeBlocking(normalSphereRequest); final JsonNode jsonNode = client().executeBlocking(jsonNodeSphereRequest);//all will be returned as JSON assertThat(jsonNode.get("results").get(0).get("productType").get("obj").get("description").asText()) .as("the expansion paths are honored") .isEqualTo("a 'T' shaped cloth"); }); } }
@BeforeClass public static void clean() { client().executeBlocking(ProductDiscountQuery.of().withPredicates(m -> m.name().locale(ENGLISH).is("example product discount"))) .getResults() .forEach(discount -> client().executeBlocking(ProductDiscountDeleteCommand.of(discount))); }
@BeforeClass public static void clean() { deleteDiscountCodesAndCartDiscounts(client()); client().executeBlocking(CartDiscountQuery.of().withPredicates(m -> m.name().locale(ENGLISH).is("sample cart discount"))) .getResults().forEach(discount -> client().executeBlocking(CartDiscountDeleteCommand.of(discount))); }
@Test public void name() { final CategoryQueryBuilder builder = CategoryQueryBuilder.of() .predicates(m -> m.id().is("f")) .fetchTotal(true) .limit(2) .offset(5) .plusPredicates(m -> m.name().locale(Locale.ENGLISH).is("bar")) .sort(m -> m.slug().locale(Locale.ENGLISH).sort().desc()) .plusExpansionPaths(m -> m.parent()); final CategoryQuery actual = builder.build(); final CategoryQuery expected = CategoryQuery.of().byId("f") .withFetchTotal(true) .withLimit(2) .withOffset(5) .plusPredicates(m -> m.name().locale(Locale.ENGLISH).is("bar")) .withSort(m -> m.slug().locale(Locale.ENGLISH).sort().desc()) .plusExpansionPaths(m -> m.parent()); assertThat(actual).isEqualTo(expected); } }
.and(m.paymentMethodInfo().method().is(paymentMethodInfo.getMethod())) .and(m.paymentMethodInfo().paymentInterface().is(paymentMethodInfo.getPaymentInterface())) .and(m.paymentMethodInfo().name().locale(ENGLISH).is(paymentMethodInfo.getName().get(ENGLISH))) .and(m.custom().type().is(type)) .and(m.paymentStatus().interfaceCode().is(paymentStatus.getInterfaceCode()))