/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_20() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, null, 0, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * Validate that the ordering of the returned Exceptions is correct * using traditional while loop */ @Test public void test12() { SQLDataException ex = new SQLDataException("Exception 1", t1); SQLDataException ex1 = new SQLDataException("Exception 2"); SQLDataException ex2 = new SQLDataException("Exception 3", t2); ex.setNextException(ex1); ex.setNextException(ex2); int num = 0; SQLException sqe = ex; while (sqe != null) { assertTrue(msgs[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextException(); } }
public void testGetDate(ResultSet resultSet, Calendar calendar) throws SQLException { try { resultSet.getDate(ordinal, calendar); fail("Was expecting to throw SQLDataException"); } catch (Exception e) { assertThat(e, isA((Class) SQLDataException.class)); // success } }
public void testGetNClob(ResultSet resultSet) throws SQLException { try { resultSet.getNClob(ordinal); fail("Was expecting to throw SQLDataException"); } catch (Exception e) { assertThat(e, isA((Class) SQLDataException.class)); // success } }
/** * Type modifier input function for IntWithMod type: accepts * "even" or "odd". The modifier value is 0 for even or 1 for odd. */ @Function(schema="javatest", name="intwithmod_typmodin", provides="IntWithMod modIn", effects=IMMUTABLE, onNullInput=RETURNS_NULL) public static int modIn(@SQLType("cstring[]") String[] toks) throws SQLException { if ( 1 != toks.length ) throw new SQLDataException( "only one type modifier allowed for IntWithMod", "22023"); if ( "even".equalsIgnoreCase(toks[0]) ) return 0; if ( "odd".equalsIgnoreCase(toks[0]) ) return 1; throw new SQLDataException( "modifier for IntWithMod must be \"even\" or \"odd\"", "22023"); }
/** * Function backing the type-modifier application cast for IntWithMod type. */ @Function(schema="javatest", name="intwithmod_typmodapply", requires="IntWithMod type", provides="IntWithMod modApply", type="javatest.IntWithMod", effects=IMMUTABLE, onNullInput=RETURNS_NULL) public static IntWithMod modApply( @SQLType("javatest.IntWithMod") IntWithMod iwm, int mod, boolean explicit) throws SQLException { if ( -1 == mod ) return iwm; if ( (iwm.m_value & 1) != mod ) throw new SQLDataException( "invalid value " + iwm + " for " + iwm.getSQLTypeName() + modOut(mod), "22000"); iwm.m_typeName += modOut(mod); return iwm; }
private static String validateDateTime(Object value, boolean timestampTz) throws SQLDataException { if (value instanceof Number) { return AtsdMeta.TIMESTAMP_PRINTER.format(((Number) value).longValue()); } else if (!(value instanceof String)) { throw new SQLDataException("Invalid value: " + value + ". Current type: " + value.getClass().getSimpleName() + ", expected type: " + Timestamp.class.getSimpleName()); } final String dateTime = value.toString(); Matcher matcher = DATETIME_ISO_PATTERN.matcher(dateTime); if (matcher.matches()) { return dateTime; } matcher = TIMESTAMP_PATTERN.matcher(dateTime); if (matcher.matches()) { final Timestamp timestamp = Timestamp.valueOf(dateTime); final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(timestamp.getTime()); if (timestampTz) { calendar.set(Calendar.ZONE_OFFSET, 0); calendar.set(Calendar.DST_OFFSET, 0); } return ISO8601Utils.format(calendar.getTime(), true); } throw new SQLDataException("Invalid datetime value: " + value + ". Expected formats: yyyy-MM-dd'T'HH:mm:ss[.SSS]'Z', yyyy-MM-dd HH:mm:ss[.fffffffff]"); }
private static Map<String, String> parseTags(String value) throws SQLDataException { if (StringUtils.isBlank(value)) { return Collections.emptyMap(); } String[] tags = StringUtils.split(value, TAGS_DELIMETER); Map<String, String> result = new LinkedHashMap<>(); Pair<String, String> nameAndValue; for (String tag : tags) { nameAndValue = parseTag(StringUtils.trim(tag)); if (nameAndValue != null) { result.put(nameAndValue.getKey(), nameAndValue.getValue()); } } return result; }
public static SQLException unboxException(SQLException exception) { final Throwable cause = exception.getCause(); if (cause instanceof SQLDataException) { return (SQLDataException) cause; } else if (cause instanceof SQLFeatureNotSupportedException) { return (SQLFeatureNotSupportedException) cause; } else if (!(cause instanceof RuntimeException)) { return exception; } Throwable finalCause = exception; if (cause instanceof AtsdRuntimeException) { Throwable inner = cause.getCause(); if (inner instanceof SQLException) { // parsed result from ATSD finalCause = cause; } } if (isMetricNotFoundException(cause.getMessage())) { return new AtsdMetricNotFoundException(exception.getMessage(), finalCause); } else { return new SQLException(exception.getMessage(), finalCause); } }
private Object extractSingleRow(ResultSetIterator iterator) throws SQLException { if (!iterator.hasNext()) { return null; } Map<String, Object> row = iterator.next(); if (iterator.hasNext()) { throw new SQLDataException("Query result not unique for outputType=SelectOne."); } else if (getEndpoint().getOutputClass() != null) { return newBeanInstance(row); } else if (row.size() == 1) { return row.values().iterator().next(); } else { return row; } }
/** * Generates Strings for RecyclerView's adapter. This data would usually come * from a local content provider or remote server. */ private void initDataset(Context ctx) { datasource = new SoulissDBTagHelper(ctx); SoulissDBHelper.open(); try { collectedTag = datasource.getTag(tagId); } catch (SQLDataException e) { Log.e(Constants.TAG, "CANT LOAD tagId" + tagId); } Log.i(Constants.TAG, "initDataset loaded TAG" + tagId + " with father ID: " + collectedTag.getFatherId()); if (!opzioni.isDbConfigured()) AlertDialogHelper.dbNotInitedDialog(ctx); }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.aggiungiFiglio: long nuovoFiglioId = datasource.createOrUpdateTag(null); try { SoulissTag figlio = datasource.getTag(nuovoFiglioId); figlio.setFatherId(collectedTag.getTagId()); collectedTag.getChildTags().add(figlio); datasource.createOrUpdateTag(collectedTag); } catch (SQLDataException e) { e.printStackTrace(); } parallaxExtAdapter.notifyItemInserted(collectedTag.getChildTags().size() - 1); return true; } //home e altro nel activity return getActivity().onOptionsItemSelected(item); }
public List<SoulissTag> getTagsByTypicals(SoulissTypical parent) { List<SoulissTag> comments = new ArrayList<>(); String MY_QUERY = "SELECT * FROM " + SoulissDBOpenHelper.TABLE_TAGS_TYPICALS + " a " + " WHERE a." + SoulissDBOpenHelper.COLUMN_TAG_TYP_NODE_ID + " = " + parent.getNodeId() + " AND a." + SoulissDBOpenHelper.COLUMN_TAG_TYP_SLOT + " = " + parent.getSlot(); Cursor cursor = database.rawQuery(MY_QUERY, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { int tagId = cursor.getInt(cursor.getColumnIndex(SoulissDBOpenHelper.COLUMN_TAG_TYP_TAG_ID)); try { SoulissTag newTag = getTag(tagId); if (!comments.contains(newTag)) comments.add(newTag); } catch (SQLDataException e) { e.printStackTrace(); } cursor.moveToNext(); } // Make sure to close the cursor cursor.close(); return comments; }
public List<String> getQueries() throws SQLDataException { CharStream input = new ANTLRInputStream(sqlWithPlaceholders); ANTLRErrorListener errorListener = new InternalErrorListener(); ParametersLexer parametersLexer = new ParametersLexer(input); parametersLexer.removeErrorListeners(); parametersLexer.addErrorListener(errorListener); CommonTokenStream commonTokenStream = new CommonTokenStream(parametersLexer); ParametersParser parametersParser = new ParametersParser(commonTokenStream); parametersParser.removeErrorListeners(); parametersParser.addErrorListener(errorListener); ParseTree parseTree = parametersParser.queries(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(this, parseTree); if (exception.isPresent()) { throw exception.get(); } return preparedQueries; }
/** * @test java.sql.SQLDataException(Throwable) */ public void test_Constructor_LThrowable() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(cause); assertNotNull(sQLDataException); assertEquals( "The reason of SQLDataException should be equals to cause.toString()", "java.lang.Exception: MYTHROWABLE", sQLDataException .getMessage()); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, Throwable) */ public void test_Constructor_LStringLThrowable() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", cause); assertNotNull(sQLDataException); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, Throwable) */ public void test_Constructor_LStringLStringLThrowable() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, Throwable) */ public void test_Constructor_LStringLStringLThrowable_1() { SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", null); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, Throwable) */ public void test_Constructor_LStringLStringLThrowable_2() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", null, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, Throwable) */ public void test_Constructor_LStringLStringLThrowable_4() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, "MYTESTSTRING", cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, Throwable) */ public void test_Constructor_LStringLStringLThrowable_6() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, null, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", 1, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_1() { SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", 1, null); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_2() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", 0, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_3() { SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", 0, null); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_4() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", -1, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be -1", sQLDataException.getErrorCode(), -1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_5() { SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING1", "MYTESTSTRING2", -1, null); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING2", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING1", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be -1", sQLDataException.getErrorCode(), -1); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_6() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", null, 1, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_7() { SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", null, 1, null); assertNotNull(sQLDataException); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_8() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", null, 0, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_10() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException( "MYTESTSTRING", null, -1, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertEquals( "The reason of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be -1", sQLDataException.getErrorCode(), -1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_12() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, "MYTESTSTRING", 1, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_14() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, "MYTESTSTRING", 0, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_15() { SQLDataException sQLDataException = new SQLDataException(null, "MYTESTSTRING", 0, null); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 0", sQLDataException.getErrorCode(), 0); assertNull("The cause of SQLDataException should be null", sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_16() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, "MYTESTSTRING", -1, cause); assertNotNull(sQLDataException); assertEquals( "The SQLState of SQLDataException set and get should be equivalent", "MYTESTSTRING", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be -1", sQLDataException.getErrorCode(), -1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }
/** * @test java.sql.SQLDataException(String, String, int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_18() { Throwable cause = new Exception("MYTHROWABLE"); SQLDataException sQLDataException = new SQLDataException(null, null, 1, cause); assertNotNull(sQLDataException); assertNull("The SQLState of SQLDataException should be null", sQLDataException.getSQLState()); assertNull("The reason of SQLDataException should be null", sQLDataException.getMessage()); assertEquals("The error code of SQLDataException should be 1", sQLDataException.getErrorCode(), 1); assertEquals( "The cause of SQLDataException set and get should be equivalent", cause, sQLDataException.getCause()); }