use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class TemplateIdTest method testGetTemplateIdNotHistoricalNoExtension.
@Test
void testGetTemplateIdNotHistoricalNoExtension() {
Context context = new Context();
context.setHistorical(false);
assertThat(TemplateId.PLACEHOLDER.getTemplateId(context)).isEqualTo(TemplateId.PLACEHOLDER.getRoot());
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class Registry method createHandlerConstructor.
private Function<Context, Object> createHandlerConstructor(Class<?> handlerClass) throws NoSuchMethodException, IllegalAccessException {
try {
Constructor<?> constructor = handlerClass.getConstructor(Context.class);
MethodHandle handle = MethodHandles.lookup().unreflectConstructor(constructor).asType(MethodType.methodType(Object.class, Context.class));
return constructorContextArgument(handle);
} catch (NoSuchMethodException thatsOk) {
Constructor<?> constructor = getNoArgsConstructor(handlerClass);
MethodHandle handle = MethodHandles.lookup().unreflectConstructor(constructor).asType(MethodType.methodType(Object.class));
return constructorNoArgs(handle);
}
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class MeasureDataValidatorTest method internalValidateSingleNode.
@Test
void internalValidateSingleNode() throws Exception {
String happy = TestHelper.getFixture("measureDataHappy.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(happy));
MeasureDataValidator validator = new MeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
Set<Detail> errors = validator.getDetails();
assertWithMessage("Expect no errors on the happy path").that(errors).isEmpty();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class QrdaValidatorTest method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
nodesPassedIntoValidateSingleNode = new ArrayList<>();
Context context = new Context();
objectUnderTest = TestHelper.mockValidator(context, RequiredTestValidator.class, new ComponentKey(TEST_REQUIRED_TEMPLATE_ID, Program.ALL), true);
objectUnderTest = TestHelper.mockValidator(context, OptionalTestValidator.class, new ComponentKey(TEST_OPTIONAL_TEMPLATE_ID, Program.ALL), false, objectUnderTest);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class MeasurePerformedDecoderTest method setUp.
@BeforeEach
void setUp() throws IOException {
context = new Context();
xmlFragment = TestHelper.getFixture("MeasurePerformed.xml");
}
Aggregations