use of org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath in project estatio by estatio.
the class Classification_remove_IntegTest method happy_case.
@Test
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();
// when
wrap(italianClassificationRed).remove();
// then
assertThat(classificationRepository.findByClassified(demoFooInItaly)).extracting(Classification::getCategory).extracting(Category::getName).doesNotContain("Red");
}
use of org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath 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.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath in project estatio by estatio.
the class DemoObjectWithAtPath_and_OtherObjectWithAtPath_create3 method createDemo.
private DemoObjectWithAtPath createDemo(final String name, final String atPath, final ExecutionContext executionContext) {
final DemoObjectWithAtPath demoObject = wrap(demoObjectMenu).createDemoObjectWithAtPath(name, atPath);
demoObjects.add(demoObject);
return executionContext.addResult(this, demoObject);
}
use of org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath in project estatio by estatio.
the class CategoryRepository_findByClassified_IntegTest method happy_case.
@Test
public void happy_case() {
// given
DemoObjectWithAtPath demoFooInItaly = demoObjectMenu.listAllDemoObjectsWithAtPath().stream().filter(d -> d.getName().equals("Demo foo (in Italy)")).findFirst().get();
assertThat(demoFooInItaly).isNotNull();
// when
List<Classification> classifications = classificationRepository.findByClassified(demoFooInItaly);
// then
assertThat(classifications.size()).isEqualTo(2);
assertThat(classifications).extracting(Classification::getCategory).extracting(Category::getName).containsOnly("Red", "Medium");
}
Aggregations