@Test public void testLoincInfoFromLoincCodeNull() { try { when(mockResultSet.next()).thenReturn(false); JLVMappedCode oMappedCode = testSubject.getLabLoincInfoFromLoincCode(null); assertNull("The result should have been null", oMappedCode); } catch (Exception e) { System.out.println("An unexpected exception occurred. Error: " + e.getMessage()); e.printStackTrace(); fail("An unexpected exception occurred. Error: " + e.getMessage()); } }
public JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc) throws TermLoadException { JLVMappedCode oMappedCode = null; if (NullChecker.isNotNullish(sLoinc)) { PreparedStatement psSelectStatement = null; ResultSet oResults = null; try { psSelectStatement = this.oDBConnection.prepareStatement(SQL_SELECT); psSelectStatement.setString(SQL_PARAM_LOINC, sLoinc); oResults = psSelectStatement.executeQuery(); boolean bHasResult = false; if (oResults.next()) { JLVMappedCode oTempMappedCode = new JLVMappedCode(); String sCode = oResults.getString(SQL_FIELD_LOINC_NUM); if (NullChecker.isNotNullish(sCode)) { oTempMappedCode.setCode(sCode); bHasResult = true; } String sText = oResults.getString(SQL_FIELD_LONG_COMMON_NAME); if (NullChecker.isNotNullish(sText)) { oTempMappedCode.setDisplayText(sText); bHasResult = true; } if (bHasResult) { oTempMappedCode.setCodeSystem(CODE_SYSTEM_LOINC); oMappedCode = oTempMappedCode; } } } catch (SQLException e) { throw new TermLoadException("Failed to read lab loinc information from the 'loinc' table. Error: " + e.getMessage(), e); } finally { TermLoadException exceptionToThrow = null; if (oResults != null) { try { oResults.close(); oResults = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the result set. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (psSelectStatement != null) { try { psSelectStatement.close(); psSelectStatement = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the prepared statement. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (exceptionToThrow != null) { throw exceptionToThrow; } } } return oMappedCode; }
JLVLoincMap { public JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc) throws TermLoadException { JLVMappedCode oMappedCode = null; if (NullChecker.isNotNullish(sLoinc)) { PreparedStatement psSelectStatement = null; ResultSet oResults = null; try { psSelectStatement = this.oDBConnection.prepareStatement(SQL_SELECT); psSelectStatement.setString(SQL_PARAM_LOINC, sLoinc); oResults = psSelectStatement.executeQuery(); boolean bHasResult = false; if (oResults.next()) { JLVMappedCode oTempMappedCode = new JLVMappedCode(); String sCode = oResults.getString(SQL_FIELD_LOINC_NUM); if (NullChecker.isNotNullish(sCode)) { oTempMappedCode.setCode(sCode); bHasResult = true; } String sText = oResults.getString(SQL_FIELD_LONG_COMMON_NAME); if (NullChecker.isNotNullish(sText)) { oTempMappedCode.setDisplayText(sText); bHasResult = true; } if (bHasResult) { oTempMappedCode.setCodeSystem(CODE_SYSTEM_LOINC); oMappedCode = oTempMappedCode; } } } catch (SQLException e) { throw new TermLoadException("Failed to read lab loinc information from the 'loinc' table. Error: " + e.getMessage(), e); } finally { TermLoadException exceptionToThrow = null; if (oResults != null) { try { oResults.close(); oResults = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the result set. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (psSelectStatement != null) { try { psSelectStatement.close(); psSelectStatement = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the prepared statement. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (exceptionToThrow != null) { throw exceptionToThrow; } } } return oMappedCode; } }
JLVLoincMap { public JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc) throws TermLoadException { JLVMappedCode oMappedCode = null; if (NullChecker.isNotNullish(sLoinc)) { PreparedStatement psSelectStatement = null; ResultSet oResults = null; try { psSelectStatement = this.oDBConnection.prepareStatement(SQL_SELECT); psSelectStatement.setString(SQL_PARAM_LOINC, sLoinc); oResults = psSelectStatement.executeQuery(); boolean bHasResult = false; if (oResults.next()) { JLVMappedCode oTempMappedCode = new JLVMappedCode(); String sCode = oResults.getString(SQL_FIELD_LOINC_NUM); if (NullChecker.isNotNullish(sCode)) { oTempMappedCode.setCode(sCode); bHasResult = true; } String sText = oResults.getString(SQL_FIELD_LONG_COMMON_NAME); if (NullChecker.isNotNullish(sText)) { oTempMappedCode.setDisplayText(sText); bHasResult = true; } if (bHasResult) { oTempMappedCode.setCodeSystem(CODE_SYSTEM_LOINC); oMappedCode = oTempMappedCode; } } } catch (SQLException e) { throw new TermLoadException("Failed to read lab loinc information from the 'loinc' table. Error: " + e.getMessage(), e); } finally { TermLoadException exceptionToThrow = null; if (oResults != null) { try { oResults.close(); oResults = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the result set. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (psSelectStatement != null) { try { psSelectStatement.close(); psSelectStatement = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the prepared statement. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (exceptionToThrow != null) { throw exceptionToThrow; } } } return oMappedCode; } @SuppressWarnings("unused") private  JLVLoincMap();  JLVLoincMap(Connection oDBConnection); }
JLVLoincMap { public JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc) throws TermLoadException { JLVMappedCode oMappedCode = null; if (NullChecker.isNotNullish(sLoinc)) { PreparedStatement psSelectStatement = null; ResultSet oResults = null; try { psSelectStatement = this.oDBConnection.prepareStatement(SQL_SELECT); psSelectStatement.setString(SQL_PARAM_LOINC, sLoinc); oResults = psSelectStatement.executeQuery(); boolean bHasResult = false; if (oResults.next()) { JLVMappedCode oTempMappedCode = new JLVMappedCode(); String sCode = oResults.getString(SQL_FIELD_LOINC_NUM); if (NullChecker.isNotNullish(sCode)) { oTempMappedCode.setCode(sCode); bHasResult = true; } String sText = oResults.getString(SQL_FIELD_LONG_COMMON_NAME); if (NullChecker.isNotNullish(sText)) { oTempMappedCode.setDisplayText(sText); bHasResult = true; } if (bHasResult) { oTempMappedCode.setCodeSystem(CODE_SYSTEM_LOINC); oMappedCode = oTempMappedCode; } } } catch (SQLException e) { throw new TermLoadException("Failed to read lab loinc information from the 'loinc' table. Error: " + e.getMessage(), e); } finally { TermLoadException exceptionToThrow = null; if (oResults != null) { try { oResults.close(); oResults = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the result set. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (psSelectStatement != null) { try { psSelectStatement.close(); psSelectStatement = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the prepared statement. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (exceptionToThrow != null) { throw exceptionToThrow; } } } return oMappedCode; } @SuppressWarnings("unused") private  JLVLoincMap();  JLVLoincMap(Connection oDBConnection); JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc); }
JLVLoincMap { public JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc) throws TermLoadException { JLVMappedCode oMappedCode = null; if (NullChecker.isNotNullish(sLoinc)) { PreparedStatement psSelectStatement = null; ResultSet oResults = null; try { psSelectStatement = this.oDBConnection.prepareStatement(SQL_SELECT); psSelectStatement.setString(SQL_PARAM_LOINC, sLoinc); oResults = psSelectStatement.executeQuery(); boolean bHasResult = false; if (oResults.next()) { JLVMappedCode oTempMappedCode = new JLVMappedCode(); String sCode = oResults.getString(SQL_FIELD_LOINC_NUM); if (NullChecker.isNotNullish(sCode)) { oTempMappedCode.setCode(sCode); bHasResult = true; } String sText = oResults.getString(SQL_FIELD_LONG_COMMON_NAME); if (NullChecker.isNotNullish(sText)) { oTempMappedCode.setDisplayText(sText); bHasResult = true; } if (bHasResult) { oTempMappedCode.setCodeSystem(CODE_SYSTEM_LOINC); oMappedCode = oTempMappedCode; } } } catch (SQLException e) { throw new TermLoadException("Failed to read lab loinc information from the 'loinc' table. Error: " + e.getMessage(), e); } finally { TermLoadException exceptionToThrow = null; if (oResults != null) { try { oResults.close(); oResults = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the result set. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (psSelectStatement != null) { try { psSelectStatement.close(); psSelectStatement = null; } catch (SQLException e) { String sErrorMessage = "Failed to close the prepared statement. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); exceptionToThrow = new TermLoadException(sErrorMessage, e); } } if (exceptionToThrow != null) { throw exceptionToThrow; } } } return oMappedCode; } @SuppressWarnings("unused") private  JLVLoincMap();  JLVLoincMap(Connection oDBConnection); JLVMappedCode getLabLoincInfoFromLoincCode(String sLoinc); static final int SQL_PARAM_LOINC; static final int SQL_FIELD_INTERNAL_ID; static final int SQL_FIELD_LOINC_NUM; static final int SQL_FIELD_COMPONENT; static final int SQL_FIELD_SHORT_NAME; static final int SQL_FIELD_LONG_COMMON_NAME; static final String CODE_SYSTEM_LOINC; }