io.sphere.sdk.models.Reference.referencesSameResource()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中io.sphere.sdk.models.Reference.referencesSameResource方法的一些代码示例,展示了Reference.referencesSameResource的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.referencesSameResource方法的具体详情如下:
包路径:io.sphere.sdk.models.Reference
类名称:Reference
方法名:referencesSameResource

Reference.referencesSameResource介绍

暂无

代码示例

代码示例来源:origin: io.sphere.sdk.jvm/sphere-test-lib

@SuppressWarnings({"rawtypes", "unchecked"})
  public ReferenceAssert references(final Referenceable counterpart) {
    if (!actual.referencesSameResource(counterpart)) {
      failWithMessage(format("%s does not reference the same as %s.", actual, counterpart));
    }
    return this;
  }
}

代码示例来源:origin: io.sphere.sdk.jvm/test-lib

@SuppressWarnings({"rawtypes", "unchecked"})
  public ReferenceAssert references(final Referenceable counterpart) {
    if (!actual.referencesSameResource(counterpart)) {
      failIfCustomMessageIsSet();
      throw failure(String.format("%s does not reference the same as %s.", actual, counterpart));
    }
    return this;
  }
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void addToCategory() throws Exception {
  withProductAndUnconnectedCategory(client(), (final Product product, final Category category) -> {
    assertThat(product.getMasterData().getStaged().getCategories()).isEmpty();
    final String orderHint = "0.123";
    final Product productWithCategory = client()
        .executeBlocking(ProductUpdateCommand.of(product, AddToCategory.of(category, orderHint)));
    final Reference<Category> categoryReference = productWithCategory.getMasterData().getStaged().getCategories().stream().findAny().get();
    assertThat(categoryReference.referencesSameResource(category)).isTrue();
    assertThat(productWithCategory.getMasterData().getStaged().getCategoryOrderHints().get(category.getId())).isEqualTo(orderHint);
    final Product productWithoutCategory = client()
        .executeBlocking(ProductUpdateCommand.of(productWithCategory, RemoveFromCategory.of(category)));
    assertThat(productWithoutCategory.getMasterData().getStaged().getCategories()).isEmpty();
  });
}

相关文章