use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_name_IntegTest method happy_case.
@Test
public void happy_case() {
// given
Category medium = categoryRepository.findByReference("M");
assertThat(medium.getFullyQualifiedName()).isEqualTo("Sizes/Medium");
// when
medium.modifyName("Middle");
// then
assertThat(medium.getName()).isEqualTo("Middle");
assertThat(medium.getFullyQualifiedName()).isEqualTo("Sizes/Middle");
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_name_IntegTest method fully_qualified_name_of_children_also_updated.
@Test
public void fully_qualified_name_of_children_also_updated() {
// given
Category large = categoryRepository.findByReference("LGE");
assertThat(large.getFullyQualifiedName()).isEqualTo("Sizes/Large");
assertThat(large.getChildren()).allMatch(c -> c.getFullyQualifiedName().split("/")[1].equals("Large"));
// when
large.modifyName("LRG");
// then
assertThat(large.getFullyQualifiedName()).isEqualTo("Sizes/LRG");
assertThat(large.getChildren()).allMatch(c -> c.getFullyQualifiedName().split("/")[1].equals("LRG"));
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_reference_IntegTest method cannot_rename_to_a_reference_already_in_use.
@Test
public void cannot_rename_to_a_reference_already_in_use() {
// given
Category smallest = categoryRepository.findByReference("XXS");
// then
expectedException.expect(InvalidException.class);
expectedException.expectMessage("A category with reference 'XS' already exists (under this parent)");
// when
wrap(smallest).setReference("XS");
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_ordinal_IntegTest method fully_qualified_name_of_children_also_updated.
@Test
public void fully_qualified_name_of_children_also_updated() {
// given
Category large = categoryRepository.findByReference("LGE");
assertThat(large.getFullyQualifiedOrdinal()).isEqualTo("1.1");
assertThat(large.getChildren()).allMatch(c -> c.getFullyQualifiedOrdinal().split("\\.")[1].equals("1"));
// when
large.modifyOrdinal(99);
// then
assertThat(large.getFullyQualifiedOrdinal()).isEqualTo("1.99");
assertThat(large.getChildren()).allMatch(c -> c.getFullyQualifiedOrdinal().split("\\.")[1].equals("99"));
}
use of org.incode.module.classification.dom.impl.category.Category in project estatio by estatio.
the class Category_ordinal_IntegTest method can_clear.
@Test
public void can_clear() {
// given
Category smallest = categoryRepository.findByReference("XXS");
assertThat(smallest.getFullyQualifiedOrdinal()).isEqualTo("1.3.3");
// when
smallest.clearOrdinal();
// then
assertThat(smallest.getFullyQualifiedOrdinal()).isEqualTo("1.3.0");
}
Aggregations