public void __testSetMaxOccurrencesOnInternalNode() throws Exception {
    flattenTemplate("test_set_occurrences_without_min.oet");

    String path = "/items[at0001]";

    CObject constraint = (CObject) flattened.node(path);

    assertEquals(
        "unexpected min occurrences", 0, constraint.getOccurrences().getLower().intValue());

    assertEquals(
        "unexpected max occurrences", 1, constraint.getOccurrences().getUpper().intValue());
  }
  public void testSetMaxOccurrencesOnArchetypeSlot() throws Exception {
    flattenTemplate("test_set_occurrences_without_min2.oet");

    String path = "/items[openEHR-EHR-EVALUATION.structured_summary.v1]";

    CObject constraint = (CObject) flattened.node(path);

    assertEquals(
        "unexpected min occurrences", 0, constraint.getOccurrences().getLower().intValue());

    assertEquals(
        "unexpected max occurrences", 1, constraint.getOccurrences().getUpper().intValue());
  }
Example #3
0
  public void testPath() throws Exception {

    // root path CAR
    assertEquals("root", "/", definition.path());

    // wheels attribute
    CAttribute wheels = definition.getAttributes().get(0);
    assertEquals("wheels", "/wheels", wheels.path());

    // first WHEEL node
    CObject firstWheel = wheels.getChildren().get(0);
    assertEquals("first wheel", "/wheels[at0001]", firstWheel.path());

    // description and parts of first WHEEL
    CComplexObject firstWheelObj = (CComplexObject) firstWheel;
    CAttribute description = firstWheelObj.getAttributes().get(0);
    assertEquals("first wheel description", "/wheels[at0001]/description", description.path());
    CAttribute parts = firstWheelObj.getAttributes().get(1);
    assertEquals("first wheel parts", "/wheels[at0001]/parts", parts.path());

    // WHEEL_PART node
    CObject wheelParts = parts.getChildren().get(0);
    assertEquals("wheelPart", "/wheels[at0001]/parts[at0002]", wheelParts.path());

    // something and something_else of WHEEL_PART node
    CComplexObject wheelPartsObj = (CComplexObject) wheelParts;
    assertEquals(
        "something of WHEEL_PART",
        "/wheels[at0001]/parts[at0002]/something",
        wheelPartsObj.getAttributes().get(0).path());

    assertEquals(
        "something_else of WHEEL_PART",
        "/wheels[at0001]/parts[at0002]/something_else",
        wheelPartsObj.getAttributes().get(1).path());
  }