use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class T_classify_IntegTest method when_applicability_and_no_classification.
@Test
public void when_applicability_and_no_classification() {
// given
DemoObjectWithAtPath demoBip = demoObjectMenu.listAllDemoObjectsWithAtPath().stream().filter(demoObject -> demoObject.getName().equals("Demo bip (in Milan)")).findFirst().get();
assertThat(classificationRepository.findByClassified(demoBip)).isEmpty();
// when
final ClassificationForDemoObjectWithAtPath.classify classification = factoryService.mixin(ClassificationForDemoObjectWithAtPath.classify.class, demoBip);
Collection<Taxonomy> choices0Classify = classification.choices0Classify();
assertThat(choices0Classify).extracting(Taxonomy::getName).containsOnly("Italian Colours", "Sizes");
List<String> categoryNames = new ArrayList<>();
for (Taxonomy taxonomy : choices0Classify) {
Category category = classification.default1Classify(taxonomy);
categoryNames.add(category.getName());
wrap(classification).classify(taxonomy, category);
}
// then
assertThat(classificationRepository.findByClassified(demoBip)).extracting(Classification::getCategory).extracting(Category::getName).containsOnlyElementsOf(categoryNames);
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParentAndReference_IntegTest method happy_case.
@Test
public void happy_case() {
// given
Category parentLarge = categoryRepository.findByReference("LGE");
// when
Category childLarge = categoryRepository.findByParentAndReference(parentLarge, "XL");
// then
assertThat(childLarge.getName()).isEqualTo("Larger");
assertThat(childLarge.getParent()).isEqualTo(parentLarge);
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParent_IntegTest method happy_case.
@Test
public void happy_case() {
// given
Category large = categoryRepository.findByReference("LGE");
// when
List<Category> results = categoryRepository.findByParent(large);
// then
assertThat(results).hasSize(3);
assertThat(results).allMatch(c -> c.getParent().equals(large));
assertThat(results).extracting(Category::getReference).containsOnly("L", "XL", "XXL");
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParent_IntegTest method when_none.
@Test
public void when_none() {
// given
Category frenchRed = categoryRepository.findByReference("FRRED");
// when
List<Category> results = categoryRepository.findByParent(frenchRed);
// then
assertThat(results).isEmpty();
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class CategoryRepository_findByParentAndName_IntegTest method when_none.
@Test
public void when_none() {
// given
Taxonomy parentFrenchColours = (Taxonomy) categoryRepository.findByReference("FRCOL");
// when
Category childFrenchColours = categoryRepository.findByParentAndName(parentFrenchColours, "Nonexisting");
// then
assertThat(childFrenchColours).isNull();
}
Aggregations