Tabnine Logo
SphereTestUtils.randomString
Code IndexAdd Tabnine to your IDE (free)

How to use
randomString
method
in
io.sphere.sdk.test.SphereTestUtils

Best Java code snippets using io.sphere.sdk.test.SphereTestUtils.randomString (Showing top 20 results out of 315)

origin: io.sphere.sdk.jvm/test-lib

public static MetaAttributes randomMetaAttributes() {
  final String metaTitle = "meta title" + randomString();
  final String metaDescription = "meta description" + randomString();
  final String metaKeywords = "meta keywords," + randomString();
  return MetaAttributes.metaAttributesOf(ENGLISH, metaTitle, metaDescription, metaKeywords);
}
origin: io.sphere.sdk.jvm/sphere-test-lib

public static MetaAttributes randomMetaAttributes() {
  final String metaTitle = "meta title" + randomString();
  final String metaDescription = "meta description" + randomString();
  final String metaKeywords = "meta keywords," + randomString();
  return MetaAttributes.metaAttributesOf(ENGLISH, metaTitle, metaDescription, metaKeywords);
}
origin: commercetools/commercetools-jvm-sdk

public static MetaAttributes randomMetaAttributes() {
  final String metaTitle = "meta title" + randomString();
  final String metaDescription = "meta description" + randomString();
  final String metaKeywords = "meta keywords," + randomString();
  return MetaAttributes.metaAttributesOf(ENGLISH, metaTitle, metaDescription, metaKeywords);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void orderNumber() throws Exception {
  final String orderNumber = randomString();
  testOrderAspect(builder -> builder.orderNumber(orderNumber),
      order -> assertThat(order.getOrderNumber()).contains(orderNumber));
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void ofTemplateShouldCopyAllProperties() throws Exception {
  final ProductVariantDraftDsl template = ProductVariantDraftBuilder.of()
      .attributes(Collections.emptyList())
      .assets(Collections.emptyList())
      .key(randomString())
      .sku(randomString())
      .prices(Collections.emptyList())
      .build();
  final ProductVariantDraftDsl copy = ProductVariantDraftBuilder.of(template).build();
  assertThat(copy).isEqualTo(template);
}
origin: commercetools/commercetools-jvm-sdk

public static void withShoppingListAndTaxedProduct(final BlockingSphereClient client, final BiFunction<ShoppingList, Product, ShoppingList> f) {
  withTaxedProduct(client, product -> {
    final ShoppingList shoppingList = createShoppingList(client, randomString());
    final ShoppingList shoppingListToDelete = f.apply(shoppingList, product);
    client.executeBlocking(ShoppingListDeleteCommand.of(shoppingListToDelete));
  });
}
origin: commercetools/commercetools-jvm-sdk

public static void withTaxedProduct(final BlockingSphereClient client, final Consumer<Product> user) {
  TaxCategoryFixtures.withTransientTaxCategory(client, taxCategory ->
          withProduct(client, randomString(), product -> {
            final Product productWithTaxes = client.executeBlocking(createSetTaxesCommand(taxCategory, product));
            user.accept(productWithTaxes);
          })
  );
}
origin: commercetools/commercetools-jvm-sdk

  public static void withUpdateableShippingMethod(final BlockingSphereClient client, final Consumer<ShippingMethod> consumer) {
    withTaxCategory(client, taxCategory -> {
      final ShippingMethodDraft draft = ShippingMethodDraft.of(randomString(), "test shipping method", taxCategory, asList());
      final ShippingMethod shippingMethod = client.executeBlocking(ShippingMethodCreateCommand.of(draft));
      consumer.accept(shippingMethod);
    });
  }
}
origin: commercetools/commercetools-jvm-sdk

  @Test
  public void constructionWithoutName() {
    final CustomerDraft customerDraft = CustomerDraftDsl.of(randomString(), "password");
    assertThat(customerDraft.getLastName()).isNull();
    assertThat(customerDraft.getFirstName()).isNull();
    assertThat(customerDraft.getName().getLastName()).isNull();
  }
}
origin: commercetools/commercetools-jvm-sdk

public static void withCustomerGroup(final BlockingSphereClient client, final UnaryOperator<CustomerGroup> consumer) {
  final String name = randomString();
  final String key = randomKey();
  final CustomerGroupDraft customerGroupDraft = CustomerGroupDraft.of(name,key);
  final CustomerGroup customerGroup = client.executeBlocking(CustomerGroupCreateCommand.of(customerGroupDraft));
  final CustomerGroup updatedCustomerGroup = consumer.apply(customerGroup);
  final Optional<CustomerGroup> customerGroupOptional = Optional.ofNullable(client.executeBlocking(CustomerGroupByIdGet.of(updatedCustomerGroup.getId())));
  customerGroupOptional.ifPresent(group -> client.executeBlocking(CustomerGroupDeleteCommand.of(updatedCustomerGroup)));
}
origin: commercetools/commercetools-jvm-sdk

public static ShoppingListDraftDsl newShoppingListDraftWithTextLineItems() {
  final List<TextLineItemDraft> textLineItemDrafts = asList(
      TextLineItemDraftBuilder.of(en(randomString()), 1L).build(),
      TextLineItemDraftBuilder.of(en(randomString()), 2L).build(),
      TextLineItemDraftBuilder.of(en(randomString()), 3L).build());
  final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftBuilder().textLineItems(textLineItemDrafts).build();
  return shoppingListDraft;
}
public static ShoppingListDraftDsl newShoppingListDraftWithLineItems(final Product product) {
origin: commercetools/commercetools-jvm-sdk

  @Test
  public void changeName() throws Exception {
    withCustomerGroup(client(), customerGroup -> {
      final String newName = randomString();
      assertThat(customerGroup.getName()).isNotEqualTo(newName);
      final CustomerGroup updatedCustomerGroup = client().executeBlocking(CustomerGroupUpdateCommand.of(customerGroup, ChangeName.of(newName)));
      assertThat(updatedCustomerGroup.getName()).isEqualTo(newName);
      return updatedCustomerGroup;
    });
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void setDescription() throws Exception {
  withUpdateableShippingMethod(client(), shippingMethod -> {
    final String newDescription = randomString();
    assertThat(shippingMethod.getDescription()).isNotEqualTo(newDescription);
    final ShippingMethodUpdateCommand cmd = ShippingMethodUpdateCommand.of(shippingMethod, SetDescription.of(newDescription));
    final ShippingMethod updatedShippingMethod = client().executeBlocking(cmd);
    assertThat(updatedShippingMethod.getDescription()).isEqualTo(newDescription);
    return updatedShippingMethod;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void changeName() throws Exception {
  withUpdateableShippingMethod(client(), shippingMethod -> {
    final String newName = randomString();
    assertThat(shippingMethod.getName()).isNotEqualTo(newName);
    final ShippingMethodUpdateCommand cmd = ShippingMethodUpdateCommand.of(shippingMethod, ChangeName.of(newName));
    final ShippingMethod updatedShippingMethod = client().executeBlocking(cmd);
    assertThat(updatedShippingMethod.getName()).isEqualTo(newName);
    return updatedShippingMethod;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void changeName() throws Exception {
  ZoneFixtures.withUpdateableZone(client(), zone -> {
    final String newName = randomString();
    assertThat(zone.getName()).isNotEqualTo(newName);
    final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, ChangeName.of(newName));
    final Zone updatedZone = client().executeBlocking(command);
    assertThat(updatedZone.getName()).isEqualTo(newName);
    return updatedZone;
  }, CountryCode.AM);
}
origin: commercetools/commercetools-jvm-sdk

public static void withUpdateableShippingMethod(final BlockingSphereClient client, final UnaryOperator<ShippingMethodDraftBuilder> builderMapper, final Function<ShippingMethod, ShippingMethod> f) {
  withTaxCategory(client, taxCategory -> {
    final ShippingMethodDraftBuilder builder = ShippingMethodDraftBuilder.of(randomString(), "test shipping method", taxCategory.toReference(), asList(), false);
    final ShippingMethodDraft draft = builderMapper.apply(builder).build();
    final ShippingMethod shippingMethod = client.executeBlocking(ShippingMethodCreateCommand.of(draft));
    final ShippingMethod possiblyUpdatedShippingMethod = f.apply(shippingMethod);
    client.executeBlocking(ShippingMethodDeleteCommand.of(possiblyUpdatedShippingMethod));
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void changeOrderStateByOrderNumber() throws Exception {
  withOrder(client(), order -> {
    assertThat(order.getOrderState()).isEqualTo(OrderState.OPEN);
    final String orderNumber = randomString();
    final Order orderWithOrderNumber = client().executeBlocking(OrderUpdateCommand.of(order, SetOrderNumber.of(orderNumber)));
    final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.ofOrderNumber(orderNumber, orderWithOrderNumber.getVersion(),
        ChangeOrderState.of(OrderState.COMPLETE)));
    assertThat(updatedOrder.getOrderState()).isEqualTo(OrderState.COMPLETE);
    return updatedOrder;
  });
}
origin: commercetools/commercetools-jvm-sdk

public static void withUpdateableShoppingList(final BlockingSphereClient client, final Function<ShoppingList, ShoppingList> f){
  final ShoppingListDraft draft = newShoppingListDraftBuilder()
      .name(en(randomString()))
      .description(en(randomString()))
      .key(randomKey())
      .slug(randomSlug()).build();
  final ShoppingList shoppingList = client.executeBlocking(ShoppingListCreateCommand.of(draft));
  final ShoppingList possiblyUpdatedShoppingList = f.apply(shoppingList);
  client.executeBlocking(ShoppingListDeleteCommand.of(possiblyUpdatedShoppingList));
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void referenceExpansion() throws Exception {
  withOrder(client(), order -> {
    assertThat(order.getOrderNumber()).isNull();
    final String orderNumber = randomString();
    final OrderUpdateCommand orderUpdateCommand = OrderUpdateCommand.of(order, SetOrderNumber.of(orderNumber)).plusExpansionPaths(m -> m.cart());
    final Order updatedOrder = client().executeBlocking(orderUpdateCommand);
    assertThat(updatedOrder.getCart().getObj()).isNotNull();
    return updatedOrder;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void queryBySku() throws Exception {
  withProduct(client(), product -> {
    final String sku = "sku-" + randomString();
    final Product productWithSku = client().executeBlocking(ProductUpdateCommand.of(product, SetSku.of(MASTER_VARIANT_ID, sku)));
    final QueryPredicate<ProductProjection> predicate = model().masterVariant().sku().is(sku);
    checkOneResult(productWithSku, predicate);
  });
}
io.sphere.sdk.testSphereTestUtilsrandomString

Popular methods of SphereTestUtils

  • randomKey
  • assertEventually
  • now
  • randomInt
  • en
  • jsonNodeFromResource
  • stringFromResource
  • asList
  • consumerToFunction
  • draftFromJsonResource
  • englishSlugOf
  • firstOf
  • englishSlugOf,
  • firstOf,
  • oneOf,
  • randomEmail,
  • randomLocalizedString,
  • randomLong,
  • randomMetaAttributes,
  • randomSlug,
  • randomSortOrder

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now