Search in sources :

Example 21 with Category

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");
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Test(org.junit.Test)

Example 22 with Category

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"));
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Test(org.junit.Test)

Example 23 with Category

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");
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Test(org.junit.Test)

Example 24 with Category

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"));
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Test(org.junit.Test)

Example 25 with Category

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");
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Test(org.junit.Test)

Aggregations

Category (org.incode.module.classification.dom.impl.category.Category)27 Test (org.junit.Test)22 Taxonomy (org.incode.module.classification.dom.impl.category.taxonomy.Taxonomy)7 Classification (org.incode.module.classification.dom.impl.classification.Classification)4 DemoObjectWithAtPath (org.incode.platform.dom.classification.integtests.demo.dom.demowithatpath.DemoObjectWithAtPath)3 ClassificationForDemoObjectWithAtPath (org.incode.platform.dom.classification.integtests.dom.classification.dom.classification.demowithatpath.ClassificationForDemoObjectWithAtPath)2 ArrayList (java.util.ArrayList)1 DomainObject (org.apache.isis.applib.annotation.DomainObject)1 TranslatableString (org.apache.isis.applib.services.i18n.TranslatableString)1 Property (org.estatio.module.asset.dom.Property)1 Unit (org.estatio.module.asset.dom.Unit)1 Lease (org.estatio.module.lease.dom.Lease)1 Occupancy (org.estatio.module.lease.dom.occupancy.Occupancy)1 OtherObjectWithAtPath (org.incode.platform.dom.classification.integtests.demo.dom.otherwithatpath.OtherObjectWithAtPath)1 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)1 Ignore (org.junit.Ignore)1