Search in sources :

Example 6 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testValidationFailureOutcome.

@Test
void testValidationFailureOutcome() {
    Metadata metadata = MetadataHelper.generateMetadata(new Node(), MetadataHelper.Outcome.VALIDATION_ERROR);
    assertThat(metadata.getOverallStatus()).isFalse();
    assertThat(metadata.getConversionStatus()).isTrue();
    assertThat(metadata.getValidationStatus()).isFalse();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 7 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testExtractsApm.

@Test
void testExtractsApm() {
    Node node = new Node();
    node.putValue(ClinicalDocumentDecoder.ENTITY_ID, MOCK_STRING);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getApm()).isEqualTo(MOCK_STRING);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 8 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testGenerateMetadataForNullNodeReturnsSkinnyMetadata.

@Test
void testGenerateMetadataForNullNodeReturnsSkinnyMetadata() {
    MetadataHelper.Outcome outcome = MetadataHelper.Outcome.VALIDATION_ERROR;
    Metadata comparison = new Metadata();
    comparison.setOverallStatus(false);
    comparison.setConversionStatus(true);
    comparison.setValidationStatus(false);
    Metadata metadata = MetadataHelper.generateMetadata(null, outcome);
    metadata.setCreatedDate(comparison.getCreatedDate());
    assertThat(metadata).isEqualTo(comparison);
}
Also used : Metadata(gov.cms.qpp.conversion.api.model.Metadata) Outcome(gov.cms.qpp.conversion.api.helper.MetadataHelper.Outcome) Test(org.junit.jupiter.api.Test)

Example 9 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testChildLacksCpcPlus.

@Test
void testChildLacksCpcPlus() {
    Node node = new Node();
    Node child = new Node();
    child.setType(TemplateId.CLINICAL_DOCUMENT);
    node.addChildNode(child);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getCpc()).isNull();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 10 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testConversionFailureOutcome.

@Test
void testConversionFailureOutcome() {
    Metadata metadata = MetadataHelper.generateMetadata(new Node(), MetadataHelper.Outcome.CONVERSION_ERROR);
    assertThat(metadata.getOverallStatus()).isFalse();
    assertThat(metadata.getConversionStatus()).isFalse();
    assertThat(metadata.getValidationStatus()).isFalse();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Aggregations

Metadata (gov.cms.qpp.conversion.api.model.Metadata)40 Test (org.junit.jupiter.api.Test)24 Node (gov.cms.qpp.conversion.model.Node)16 Source (gov.cms.qpp.conversion.Source)5 ConversionReport (gov.cms.qpp.conversion.ConversionReport)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 ResponseEntity (org.springframework.http.ResponseEntity)3 InvalidFileTypeException (gov.cms.qpp.conversion.api.exceptions.InvalidFileTypeException)2 NoFileInDatabaseException (gov.cms.qpp.conversion.api.exceptions.NoFileInDatabaseException)2 Outcome (gov.cms.qpp.conversion.api.helper.MetadataHelper.Outcome)2 AcceptanceTest (gov.cms.qpp.test.annotations.AcceptanceTest)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)1 AuditException (gov.cms.qpp.conversion.api.exceptions.AuditException)1 InvalidPurposeException (gov.cms.qpp.conversion.api.exceptions.InvalidPurposeException)1 UncheckedInterruptedException (gov.cms.qpp.conversion.api.exceptions.UncheckedInterruptedException)1 MetadataHelper (gov.cms.qpp.conversion.api.helper.MetadataHelper)1 Constants (gov.cms.qpp.conversion.api.model.Constants)1 UnprocessedCpcFileData (gov.cms.qpp.conversion.api.model.UnprocessedCpcFileData)1 InputStream (java.io.InputStream)1