public static Reference<TaxCategory> reference(final TaxCategory taxCategory) { return new Reference<>(typeId(), taxCategory.getId(), Optional.ofNullable(taxCategory)); }
public static Reference<TaxCategory> reference(final TaxCategory taxCategory) { return new Reference<>(typeId(), taxCategory.getId(), Optional.ofNullable(taxCategory)); }
@Override default Reference<TaxCategory> toReference() { return Reference.of(typeId(), getId(), this); }
@Override default Reference<TaxCategory> toReference() { return Reference.of(referenceTypeId(), getId(), this); }
@Override default Reference<TaxCategory> toReference() { return Reference.of(referenceTypeId(), getId(), this); }
@Override default Reference<TaxCategory> toReference() { return Reference.of(referenceTypeId(), getId(), this); }
@Test public void execution() { withTaxCategory(client(), taxCategory -> { final TaxCategory loadedTaxCategory = client().executeBlocking(TaxCategoryByIdGet.of(taxCategory.getId())); assertThat(loadedTaxCategory).isEqualTo(taxCategory); }); } }
@Test public void changeTaxCategory() throws Exception { final TaxCategory newTaxCategory = TaxCategoryFixtures.defaultTaxCategory(client()); withUpdateableShippingMethod(client(), shippingMethod -> { assertThat(shippingMethod.getTaxCategory().getId()).isNotEqualTo(newTaxCategory.getId()); final ShippingMethodUpdateCommand cmd = ShippingMethodUpdateCommand.of(shippingMethod, ChangeTaxCategory.of(newTaxCategory)); final ShippingMethod updatedShippingMethod = client().executeBlocking(cmd); assertThat(updatedShippingMethod.getTaxCategory().getId()).isEqualTo(newTaxCategory.getId()); return updatedShippingMethod; }); }
@Test public void deleteByVersioned() { final List<TaxRateDraft> taxRates = singletonList(TaxRateDraftBuilder.of("de19", 0.19, true, CountryCode.DE).build()); final TaxCategoryDraft taxCategoryDraft = TaxCategoryDraftBuilder.of(randomKey(), taxRates, "tax category description") .build(); final TaxCategory taxCategory = client().executeBlocking(TaxCategoryCreateCommand.of(taxCategoryDraft)); final String taxCategoryId = taxCategory.getId(); client().executeBlocking(TaxCategoryDeleteCommand.of(taxCategory)); final TaxCategory deletedTaxCategory = client().executeBlocking(TaxCategoryByIdGet.of(taxCategoryId)); assertThat(deletedTaxCategory).isNull(); }