Search in sources :

Example 1 with QrdaDecoder

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

the class NoArgThrowableConstructor method testRegistryGetHandlerWithNoDefaultConstructor.

@Test
void testRegistryGetHandlerWithNoDefaultConstructor() {
    registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), NoDefaultConstructor.class);
    QrdaDecoder decoder = registry.get(TemplateId.PLACEHOLDER);
    assertWithMessage("Registry without a default constructor should not be constructable").that(decoder).isNull();
}
Also used : QrdaDecoder(gov.cms.qpp.conversion.decode.QrdaDecoder) Test(org.junit.jupiter.api.Test)

Example 2 with QrdaDecoder

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

the class NoArgThrowableConstructor method testRegistryGetDefaultConverterHandler.

@Test
void testRegistryGetDefaultConverterHandler() {
    context.setProgram(Program.CPC);
    registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), Placeholder.class);
    QrdaDecoder decoder = registry.get(TemplateId.PLACEHOLDER);
    assertWithMessage("Registry should return %s instance.", Placeholder.class.getName()).that(decoder).isInstanceOf(Placeholder.class);
}
Also used : QrdaDecoder(gov.cms.qpp.conversion.decode.QrdaDecoder) Test(org.junit.jupiter.api.Test)

Example 3 with QrdaDecoder

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

the class NoArgThrowableConstructor method testRegistry_placeAndFetch.

// This test must reside here in order to call the protected methods on the
// registry
@Test
void testRegistry_placeAndFetch() {
    Set<ComponentKey> componentKeys = registry.getComponentKeys(AggregateCountDecoder.class);
    assertThat(componentKeys).hasSize(1);
    for (ComponentKey componentKey : componentKeys) {
        QrdaDecoder decoder = registry.get(componentKey.getTemplate());
        assertWithMessage("A handler is expected").that(decoder).isNotNull();
        assertWithMessage("Handler should be an instance of the handler for the given XPATH").that(decoder).isInstanceOf(AggregateCountDecoder.class);
    }
}
Also used : QrdaDecoder(gov.cms.qpp.conversion.decode.QrdaDecoder) Test(org.junit.jupiter.api.Test)

Example 4 with QrdaDecoder

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

the class NoArgThrowableConstructor method testRegistryAddDuplicate.

@Test
void testRegistryAddDuplicate() {
    registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), Placeholder.class);
    registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), AnotherPlaceholder.class);
    QrdaDecoder decoder = registry.get(TemplateId.PLACEHOLDER);
    assertWithMessage("Registry should have overwritten id with the second one.").that(decoder).isInstanceOf(AnotherPlaceholder.class);
}
Also used : QrdaDecoder(gov.cms.qpp.conversion.decode.QrdaDecoder) Test(org.junit.jupiter.api.Test)

Example 5 with QrdaDecoder

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

the class NoArgThrowableConstructor method testRegistryGetHandlerThatFailsConstruction.

@Test
void testRegistryGetHandlerThatFailsConstruction() {
    registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), PrivateConstructor.class);
    QrdaDecoder decoder = registry.get(TemplateId.PLACEHOLDER);
    assertWithMessage("Registry with a private constructor should be constructable").that(decoder).isNotNull();
}
Also used : QrdaDecoder(gov.cms.qpp.conversion.decode.QrdaDecoder) Test(org.junit.jupiter.api.Test)

Aggregations

QrdaDecoder (gov.cms.qpp.conversion.decode.QrdaDecoder)8 Test (org.junit.jupiter.api.Test)8