/** * 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 CategoryDraftBuilder of(final CategoryDraft template) { return new CategoryDraftBuilder(template.getAssets(), template.getCustom(), template.getDescription(), template.getExternalId(), template.getKey(), template.getMetaDescription(), template.getMetaKeywords(), template.getMetaTitle(), template.getName(), template.getOrderHint(), template.getParent(), template.getSlug()); }
/** * 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 CategoryDraftDsl of(final CategoryDraft template) { return new CategoryDraftDsl(template.getAssets(), template.getCustom(), template.getDescription(), template.getExternalId(), template.getKey(), template.getMetaDescription(), template.getMetaKeywords(), template.getMetaTitle(), template.getName(), template.getOrderHint(), template.getParent(), template.getSlug()); } }
@Test public void copyFromCategory() { final Category parent = CategoryBuilder.of(randomString(), LocalizedString.ofEnglish(randomString()), LocalizedString.ofEnglish(randomString())) .build(); final Category category = CategoryBuilder.of(randomString(), LocalizedString.ofEnglish(randomString()), LocalizedString.ofEnglish(randomString())) .externalId(randomString()) .key(randomKey()) .parent(parent) .assets(null) .build(); final CategoryDraft categoryDraft = CategoryDraftBuilder.of(category).build(); assertThat(category.getName()).isEqualTo(categoryDraft.getName()); assertThat(category.getSlug()).isEqualTo(categoryDraft.getSlug()); assertThat(category.getExternalId()).isEqualTo(categoryDraft.getExternalId()); assertThat(category.getParent()).isEqualTo(categoryDraft.getParent()); assertThat(category.getAssets()).isEqualTo(categoryDraft.getAssets()); assertThat(category.getKey()).isEqualTo(categoryDraft.getKey()); } }