Remove validation in code which will never reached for the conditions.
This commit is contained in:
parent
45549d2bb9
commit
cb68c59fb5
|
@ -5,7 +5,6 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink;
|
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConceptProperty;
|
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.ITermCodeSystemStorageSvc;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
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'");
|
"' 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<String> mandatoryFilenameFragments = Arrays.asList(
|
List<String> mandatoryFilenameFragments = Arrays.asList(
|
||||||
uploadProperties.getProperty(LOINC_ANSWERLIST_FILE.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode()),
|
uploadProperties.getProperty(LOINC_ANSWERLIST_FILE.getCode(), LOINC_ANSWERLIST_FILE_DEFAULT.getCode()),
|
||||||
uploadProperties.getProperty(LOINC_ANSWERLIST_LINK_FILE.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode()),
|
uploadProperties.getProperty(LOINC_ANSWERLIST_LINK_FILE.getCode(), LOINC_ANSWERLIST_LINK_FILE_DEFAULT.getCode()),
|
||||||
|
|
|
@ -86,7 +86,6 @@ import static org.mockito.Mockito.reset;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TerminologyLoaderSvcLoincTest.class);
|
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());
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue