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()));
}
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);
}
Aggregations