/** * Creates a new builder with the values of this object. * * @return new builder */ public TaxCategoryDraftBuilder newBuilder() { return new TaxCategoryDraftBuilder(description, key, name, taxRates); }
public TaxCategoryDraftDsl withDescription(@Nullable final String description) { return newBuilder().description(description).build(); }
private TaxCategory createTaxCategory() { final TaxRateDraft taxRate = TaxRateDraft.of("GERMAN default tax", 0.19, false, DE); final TaxCategoryDraft taxCategoryDraft = TaxCategoryDraftBuilder.of("German tax", singletonList(taxRate), "Normal-Steuersatz").key(KEY).build(); final TaxCategory taxCategory = client().executeBlocking(TaxCategoryCreateCommand.of(taxCategoryDraft)); return taxCategory; } }
@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(); }
@Test public void deleteByKey() { final String key = randomKey(); final List<TaxRateDraft> taxRates = singletonList(TaxRateDraftBuilder.of("de19", 0.19, true, CountryCode.DE).build()); final TaxCategoryDraft taxCategoryDraft = TaxCategoryDraftBuilder.of(randomKey(), taxRates, "tax category description") .key(key) .build(); final TaxCategory taxCategory = client().executeBlocking(TaxCategoryCreateCommand.of(taxCategoryDraft)); client().executeBlocking(TaxCategoryDeleteCommand.ofKey(taxCategory.getKey(), taxCategory.getVersion())); final TaxCategory deletedTaxCategory = client().executeBlocking(TaxCategoryByKeyGet.of(key)); assertThat(deletedTaxCategory).isNull(); } }
/** * Creates a new object initialized with the given values. * * @param name initial value for the {@link TaxCategoryDraft#getName()} property * @param taxRates initial value for the {@link TaxCategoryDraft#getTaxRates()} property * @param description initial value for the {@link TaxCategoryDraft#getDescription()} property * @return new object initialized with the given values */ public static TaxCategoryDraftBuilder of(final String name, final List<TaxRateDraft> taxRates, @Nullable final String description) { return new TaxCategoryDraftBuilder(description, null, name, taxRates); }
/** * Creates a new object initialized with the fields of the template parameter. * * @param template the template * @return a new object initialized from the template */ public static TaxCategoryDraftBuilder of(final TaxCategoryDraft template) { return new TaxCategoryDraftBuilder(template.getDescription(), template.getKey(), template.getName(), template.getTaxRates()); } }