From cb68c59fb5c586ae0300bd3744806bc82c898552 Mon Sep 17 00:00:00 2001 From: "juan.marchionatto" Date: Tue, 3 Aug 2021 15:39:02 -0400 Subject: [PATCH] Remove validation in code which will never reached for the conditions. --- .../ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java | 8 -------- .../jpa/term/TerminologyLoaderSvcLoincTest.java | 16 ---------------- 2 files changed, 24 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java index e1677fd1a7d..60f2952754c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermLoaderSvcImpl.java @@ -5,7 +5,6 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; import ca.uhn.fhir.jpa.entity.TermConceptProperty; -import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc; @@ -232,13 +231,6 @@ public class TermLoaderSvcImpl implements ITermLoaderSvc { "' property is required when '" + LOINC_CODESYSTEM_MAKE_CURRENT.getCode() + "' property is 'false'"); } - if (! isMakeCurrentVersion - && theRequestDetails.getOperation() != null - && ! theRequestDetails.getOperation().equals(JpaConstants.OPERATION_UPLOAD_EXTERNAL_CODE_SYSTEM)) { - throw new InvalidRequestException("Delta operations require '" + LOINC_CODESYSTEM_MAKE_CURRENT.getCode() + - "' parameter set (or defaulted to) 'true'"); - } - List mandatoryFilenameFragments = Arrays.asList( uploadProperties.getProperty(LOINC_ANSWERLIST_FILE.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode()), uploadProperties.getProperty(LOINC_ANSWERLIST_LINK_FILE.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode()), diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincTest.java index 0979240d6e0..6e771593a33 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincTest.java @@ -86,7 +86,6 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TerminologyLoaderSvcLoincTest.class); @@ -939,21 +938,6 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest { LOINC_CODESYSTEM_MAKE_CURRENT.getCode() + "' property is 'false'", thrown.getMessage()); } - - - @Test - public void testNoSnapshotAndNoMakeCurrentThrows() { - testProps.put(LOINC_CODESYSTEM_MAKE_CURRENT.getCode(), "false"); - testProps.put(LOINC_CODESYSTEM_VERSION.getCode(), "27.0"); - when(mySrd.getOperation()).thenReturn(JpaConstants.OPERATION_APPLY_CODESYSTEM_DELTA_ADD); - doReturn(mockFileDescriptors).when(testedSvc).getLoadedFileDescriptors(mockFileDescriptorList); - - InvalidRequestException thrown = Assertions.assertThrows(InvalidRequestException.class, - () -> testedSvc.loadLoinc(mockFileDescriptorList, mySrd) ); - - assertEquals("Delta operations require '" + LOINC_CODESYSTEM_MAKE_CURRENT.getCode() + - "' parameter set (or defaulted to) 'true'", thrown.getMessage()); - } }