Search in sources :

Example 1 with ModelSpecifier

use of org.hl7.elm_modelinfo.r1.ModelSpecifier in project quality-measure-and-cohort-service by Alvearie.

the class ModelUtilsTest method testGetBaseTypeNameIncludedNamespacePrefixMissing.

@Test
public void testGetBaseTypeNameIncludedNamespacePrefixMissing() {
    ModelSpecifier otherModel = new ModelSpecifier().withName("Other").withVersion("1.2.3").withUrl("urn:oid:Other");
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setName("Dummy");
    modelInfo.setVersion("5.4.3");
    modelInfo.setUrl("urn:oid:Dummy");
    modelInfo.getRequiredModelInfo().add(otherModel);
    ClassInfo typeInfo = new ClassInfo();
    typeInfo.setName("MyType");
    typeInfo.setBaseType("Missing.BaseType");
    IllegalArgumentException iex = assertThrows(IllegalArgumentException.class, () -> ModelUtils.getBaseTypeName(modelInfo, typeInfo));
    assertTrue(iex.getMessage(), iex.getMessage().contains("Missing"));
    assertTrue(iex.getMessage(), iex.getMessage().contains(modelInfo.getName()));
    assertTrue(iex.getMessage(), iex.getMessage().contains(modelInfo.getVersion()));
}
Also used : ModelInfo(org.hl7.elm_modelinfo.r1.ModelInfo) ModelSpecifier(org.hl7.elm_modelinfo.r1.ModelSpecifier) ClassInfo(org.hl7.elm_modelinfo.r1.ClassInfo) Test(org.junit.Test)

Example 2 with ModelSpecifier

use of org.hl7.elm_modelinfo.r1.ModelSpecifier in project quality-measure-and-cohort-service by Alvearie.

the class ModelUtilsTest method testGetBaseTypeNameIncludedNamespacePrefixValid.

@Test
public void testGetBaseTypeNameIncludedNamespacePrefixValid() {
    ModelSpecifier otherModel = new ModelSpecifier().withName("Other").withVersion("1.2.3").withUrl("urn:oid:Other");
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setName("Dummy");
    modelInfo.setUrl("urn:oid:Dummy");
    modelInfo.getRequiredModelInfo().add(otherModel);
    ClassInfo typeInfo = new ClassInfo();
    typeInfo.setName("MyType");
    typeInfo.setBaseType("Other.BaseType");
    QName qname = ModelUtils.getBaseTypeName(modelInfo, typeInfo);
    assertEquals(new QName(otherModel.getUrl(), "BaseType"), qname);
}
Also used : ModelInfo(org.hl7.elm_modelinfo.r1.ModelInfo) ModelSpecifier(org.hl7.elm_modelinfo.r1.ModelSpecifier) QName(javax.xml.namespace.QName) ClassInfo(org.hl7.elm_modelinfo.r1.ClassInfo) Test(org.junit.Test)

Aggregations

ClassInfo (org.hl7.elm_modelinfo.r1.ClassInfo)2 ModelInfo (org.hl7.elm_modelinfo.r1.ModelInfo)2 ModelSpecifier (org.hl7.elm_modelinfo.r1.ModelSpecifier)2 Test (org.junit.Test)2 QName (javax.xml.namespace.QName)1