本文整理了Java中io.sphere.sdk.models.Reference.referencesSameResource
方法的一些代码示例,展示了Reference.referencesSameResource
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.referencesSameResource
方法的具体详情如下:
包路径:io.sphere.sdk.models.Reference
类名称: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();
});
}
内容来源于网络,如有侵权,请联系作者删除!