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

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

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

origin: commercetools/commercetools-jvm-sdk

  public static CustomerDraftDsl newCustomerDraft() {
    return CustomerDraftDsl.of(CUSTOMER_NAME, randomEmail(CustomerFixtures.class), PASSWORD);
  }
}
origin: commercetools/commercetools-jvm-sdk

  @Test
  public void getShippingAddressIdsInEmptyCase() {
    final CustomerDraft draft = CustomerDraftDsl.of(randomEmail(getClass()), "secret");
    final CustomerSignInResult customerSignInResult =
        client().executeBlocking(CustomerCreateCommand.of(draft));
    final Customer customer = customerSignInResult.getCustomer();
    assertThat(customer.getBillingAddressIds()).isNotNull().isEmpty();
    assertThat(customer.getShippingAddressIds()).isNotNull().isEmpty();
    assertThat(customer.getAddresses()).isNotNull().isEmpty();
    assertThat(customer.getShippingAddresses()).isNotNull().isEmpty();
    assertThat(customer.getBillingAddresses()).isNotNull().isEmpty();
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void createCustomerWithCart() throws Exception {
  final Cart cart = client().executeBlocking(CartCreateCommand.of(CartDraft.of(EUR)));//could of course be filled with products
  final String email = randomEmail(CustomerCreateCommandIntegrationTest.class);
  final CustomerDraft draft = CustomerDraftDsl.of(CUSTOMER_NAME, email, PASSWORD).withCart(cart);
  final CustomerSignInResult result = client().executeBlocking(CustomerCreateCommand.of(draft));
  assertThat(result.getCart()).isNotNull();
  assertThat(result.getCart().getId()).isEqualTo(cart.getId());
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void createCustomerWithCartWithCartExpansion() {
  final CustomerGroup customerGroup = CustomerGroupFixtures.b2cCustomerGroup(client());
  final Cart cart = client().executeBlocking(CartCreateCommand.of(CartDraft.of(EUR)));
  final String email = randomEmail(CustomerCreateCommandIntegrationTest.class);
  final CustomerDraft draft = CustomerDraftDsl.of(CUSTOMER_NAME, email, PASSWORD).withCart(cart).withCustomerGroup(customerGroup);
  final CustomerCreateCommand customerCreateCommand = CustomerCreateCommand.of(draft)
      .withExpansionPaths(m -> m.cart().customerGroup());
  final CustomerSignInResult result = client().executeBlocking(customerCreateCommand);
  assertThat(result.getCart()).isNotNull();
  assertThat(result.getCart().getId()).isEqualTo(cart.getId());
  assertThat(result.getCart().getCustomerGroup().getObj()).isEqualTo(customerGroup);
}
origin: commercetools/commercetools-jvm-sdk

final CustomerGroup customerGroup = CustomerGroupFixtures.b2cCustomerGroup(client());
final CustomerName name = CustomerName.ofFirstAndLastName("John", "Smith");
final String email = randomEmail(CustomerCreateCommandIntegrationTest.class);
final String externalId = randomString();
final String password = "secret";
origin: commercetools/commercetools-jvm-sdk

@Test
public void anonymousId() {
  final String anonymousId = randomKey();
  final CartDraft cartDraft = CartDraft.of(EUR).withCountry(DE).withAnonymousId(anonymousId);
  final Cart cart = client().executeBlocking(CartCreateCommand.of(cartDraft));
  final String email = randomEmail(CustomerCreateCommandIntegrationTest.class);
  final CustomerDraft customerDraft = CustomerDraftBuilder
      .of(email, "secret")
      .anonymousId(anonymousId)
      .build();
  final CustomerSignInResult customerSignInResult = client().executeBlocking(CustomerCreateCommand.of(customerDraft));
  assertThat(customerSignInResult.getCustomer().getEmail()).isEqualTo(email);
  assertThat(customerSignInResult.getCart().getId())
      .as("the customer gets the cart from the anonymous session assigned on sign-up")
      .isEqualTo(cart.getId());
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void changeEmail() throws Exception {
  withCustomer(client(), customer -> {
    final String newEmail = randomEmail(CustomerUpdateCommandIntegrationTest.class);
    assertThat(customer.getEmail()).isNotEqualTo(newEmail);
    final Customer updatedCustomer = client().executeBlocking(CustomerUpdateCommand.of(customer, ChangeEmail.of(newEmail)));
    assertThat(updatedCustomer.getEmail()).isEqualTo(newEmail);
    Query<CustomerEmailChangedMessage> messageQuery = MessageQuery.of()
        .withPredicates(m -> m.resource().is(customer))
        .withSort(m -> m.createdAt().sort().desc())
        .withLimit(1L)
        .forMessageType(CustomerEmailChangedMessage.MESSAGE_HINT);
    assertEventually(() -> {
      final PagedQueryResult<CustomerEmailChangedMessage> queryResult = client().executeBlocking(messageQuery);
      assertThat(queryResult.head()).isPresent();
      final CustomerEmailChangedMessage message = queryResult.head().get();
      assertThat(message.getEmail()).isEqualTo(newEmail);
    });
  });
}
origin: commercetools/commercetools-jvm-sdk

  private static Customer createCustomer(final String firstName, final String lastName,final String middleName, final String title) {
    final CustomerName customerName = CustomerName.ofFirstAndLastName(firstName, lastName);
    final CustomerDraft draft = CustomerDraftDsl.of(customerName, randomEmail(CustomerQueryIntegrationTest.class), "secret")
        .withLocale(Locale.GERMAN)
        .withMiddleName(middleName)
        .withTitle(title)
        .withExternalId(randomString()+firstName)
        .withCustomerNumber(randomKey());
    final CustomerSignInResult signInResult = client().executeBlocking(CustomerCreateCommand.of(draft));
    final Customer initialCustomer = signInResult.getCustomer();

    final Customer updatedCustomer = client().executeBlocking(CustomerUpdateCommand.of(initialCustomer, asList(AddAddress.of(AddressBuilder.of(CountryCode.DE).city(randomString()).build()), SetCustomerGroup.of(b2cCustomerGroup(client())))));

    final SetDefaultShippingAddress shippingAddressAction = SetDefaultShippingAddress.ofAddress(updatedCustomer.getAddresses().get(0));
    final SetDefaultBillingAddress billingAddressAction = SetDefaultBillingAddress.ofAddress(updatedCustomer.getAddresses().get(0));
    return client().executeBlocking(CustomerUpdateCommand.of(updatedCustomer, asList(shippingAddressAction, billingAddressAction)));
  }
}
io.sphere.sdk.testSphereTestUtilsrandomEmail

Popular methods of SphereTestUtils

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

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Join (org.hibernate.mapping)
  • Top plugins for WebStorm
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