Skip to content

Commit

Permalink
MAT-6224 PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adongare committed Feb 29, 2024
1 parent 0182e66 commit 2298a2c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
11 changes: 1 addition & 10 deletions src/main/java/gov/cms/madie/services/HqmfService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import gov.cms.madie.hqmf.HQMFGeneratorFactory;
import gov.cms.madie.hqmf.dto.MeasureExport;
import gov.cms.madie.models.measure.QdmMeasure;
import jakarta.xml.bind.JAXBException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
Expand All @@ -22,15 +21,7 @@ public String generateHqmf(QdmMeasure qdmMeasure) {
String simpleXml;
try {
simpleXml = simpleXmlService.measureToSimpleXml(qdmMeasure);
} catch (JAXBException ex) {
String message =
"An issue occurred while generating the simple xml for measure: " + qdmMeasure.getId();
log.error(message, ex);
throw new PackagingException(message, ex);
}

Generator hqmfGenerator = hqmfGeneratorFactory.getHQMFGenerator();
try {
Generator hqmfGenerator = hqmfGeneratorFactory.getHQMFGenerator();
MeasureExport measureExport =
MeasureExport.builder().measure(qdmMeasure).simpleXml(simpleXml).build();
return hqmfGenerator.generate(measureExport);
Expand Down
15 changes: 0 additions & 15 deletions src/test/java/gov/cms/madie/services/HqmfServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import gov.cms.madie.hqmf.qdm_5_6.HQMFGenerator;
import gov.cms.madie.models.common.ModelType;
import gov.cms.madie.models.measure.QdmMeasure;
import jakarta.xml.bind.JAXBException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -57,20 +56,6 @@ void generateHqmf() throws Exception {
assertThat(output, is(equalTo("<QualityMeasureDocument></QualityMeasureDocument>")));
}

@Test
void generateHqmfWhenSimpleXmlGenerationFailed() throws Exception {
String message = "An issue occurred while generating the simple xml for measure";
doThrow(new JAXBException(message))
.when(simpleXmlService)
.measureToSimpleXml(any(QdmMeasure.class));
Exception ex =
assertThrows(
PackagingException.class,
() -> hqmfService.generateHqmf(measure),
"Exception occurred");
assertThat(ex.getMessage(), containsString(message));
}

@Test
void generateHqmfWhenHqmfGenerationFailed() throws Exception {
when(simpleXmlService.measureToSimpleXml(any(QdmMeasure.class)))
Expand Down

0 comments on commit 2298a2c

Please sign in to comment.