Search in sources :

Example 56 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class TemplateIdTest method testGetTemplateIdHistoricalNoExtension.

@Test
void testGetTemplateIdHistoricalNoExtension() {
    Context context = new Context();
    context.setHistorical(true);
    assertThat(TemplateId.PLACEHOLDER.getTemplateId(context)).isEqualTo(TemplateId.PLACEHOLDER.getRoot());
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 57 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class TemplateIdTest method setup.

@BeforeAll
static void setup() {
    defaultsContext = new Context();
    defaultsContext.setDoDefaults(true);
}
Also used : Context(gov.cms.qpp.conversion.Context) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 58 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class TemplateIdTest method testFindByTypeId2.

@Test
void testFindByTypeId2() {
    TemplateId clinicalDocument = TemplateId.CLINICAL_DOCUMENT;
    TemplateId actual = TemplateId.getTemplateId(clinicalDocument.getRoot(), clinicalDocument.getExtension(), new Context());
    assertThat(actual).isSameAs(clinicalDocument);
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 59 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class TemplateIdTest method testGenerateTemplateIdString.

@Test
void testGenerateTemplateIdString() {
    final String root = "asdf";
    final String extension = "jkl;";
    String actual = TemplateId.generateTemplateIdString(root, extension, new Context());
    assertThat(actual).isEqualTo(root + ":" + extension);
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 60 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class TemplateIdTest method testInvalidExtensionFindWithExtensionEnforcementHappy.

@ParameterizedTest
@EnumSource(value = TemplateId.class)
void testInvalidExtensionFindWithExtensionEnforcementHappy(TemplateId templateId) {
    System.setProperty(Extension.STRICT_EXTENSION, "yep");
    TemplateId actual = TemplateId.getTemplateId(templateId.getRoot(), templateId.getExtension(), new Context());
    assertThat(actual).isSameAs(templateId);
}
Also used : Context(gov.cms.qpp.conversion.Context) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Context (gov.cms.qpp.conversion.Context)114 Test (org.junit.jupiter.api.Test)92 Node (gov.cms.qpp.conversion.model.Node)63 BufferedWriter (java.io.BufferedWriter)17 StringWriter (java.io.StringWriter)17 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)14 Element (org.jdom2.Element)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 QppOutputEncoder (gov.cms.qpp.conversion.encode.QppOutputEncoder)8 ArrayList (java.util.ArrayList)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 TemplateId (gov.cms.qpp.conversion.model.TemplateId)4 Detail (gov.cms.qpp.conversion.model.error.Detail)4 InputStream (java.io.InputStream)4 Namespace (org.jdom2.Namespace)4 Map (java.util.Map)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Converter (gov.cms.qpp.conversion.Converter)2 PathSource (gov.cms.qpp.conversion.PathSource)2 ComponentKey (gov.cms.qpp.conversion.model.ComponentKey)2