use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_removeChild_IntegTest method happy_case_cascading.
@Test
public void happy_case_cascading() {
// given
Category sizes = categoryRepository.findByReference("SIZES");
Category large = categoryRepository.findByReference("LGE");
assertThat(sizes.getChildren()).contains(large);
assertThat(large.getChildren()).isNotEmpty();
// when
wrap(sizes).removeChild(large);
transactionService.nextTransaction();
// then
assertThat(sizes.getChildren()).doesNotContain(large);
assertThat(categoryRepository.findByReference("LGE")).isNull();
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Classification_category_IntegTest method happy_case.
@Ignore
public void happy_case() {
// given
DemoObjectWithAtPath demoFooInItaly = demoObjectMenu.listAllDemoObjectsWithAtPath().stream().filter(demoObject -> demoObject.getName().equals("Demo foo (in Italy)")).findFirst().get();
Classification italianClassificationRed = classificationRepository.findByClassified(demoFooInItaly).stream().filter(classification -> classification.getCategory().getName().equals("Red")).findFirst().get();
Category italianGreen = categoryRepository.findByReference("GREEN");
// when
wrap(italianClassificationRed).setCategory(italianGreen);
// then
assertThat(classificationRepository.findByClassified(demoFooInItaly)).extracting(Classification::getCategory).extracting(Category::getName).contains("Green").doesNotContain("Red");
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParentAndReference_IntegTest method when_none.
@Test
public void when_none() {
// given
Category parentLarge = categoryRepository.findByReference("LGE");
// when
Category childLarge = categoryRepository.findByParentAndReference(parentLarge, "XXXXL");
// then
assertThat(childLarge).isNull();
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParentAndName_IntegTest method happy_case.
@Test
public void happy_case() {
// given
Category parentLarge = categoryRepository.findByReference("LGE");
// when
Category childLarge = categoryRepository.findByParentAndName(parentLarge, "Larger");
// then
assertThat(childLarge.getReference()).isEqualTo("XL");
assertThat(childLarge.getParent()).isEqualTo(parentLarge);
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParentCascade_IntegTest method when_no_grandchildren.
@Test
public void when_no_grandchildren() {
// given
Category parentLarge = categoryRepository.findByReference("LGE");
// when
List<Category> childrenLarge = categoryRepository.findByParentCascade(parentLarge);
// then
assertThat(childrenLarge).hasSize(3);
assertThat(childrenLarge).extracting(Category::getFullyQualifiedName).containsOnly("Sizes/Large/Large", "Sizes/Large/Larger", "Sizes/Large/Largest");
}
Aggregations