### Question:
DB2JCCExceptionFormatter implements ExceptionFormatter { public String format(Throwable t) throws Exception { Utilities.checkNull("format", "t", t); StringBuilder builder = new StringBuilder(); Method getSqlca = t.getClass().getMethod(METHOD_GET_SQLCA, (Class[]) null); Object sqlca = getSqlca.invoke(t, (Object[]) null); Method getMessage = sqlca.getClass().getMethod(METHOD_GET_MESSAGE, (Class[]) null); String msg = getMessage.invoke(sqlca, (Object[]) null).toString(); Method getSqlCode = sqlca.getClass().getMethod(METHOD_GET_SQL_CODE, (Class[]) null); int sqlCode = (Integer) getSqlCode.invoke(sqlca, (Object[]) null); Method getSqlState = sqlca.getClass().getMethod(METHOD_GET_SQL_STATE, (Class[]) null); String sqlState = getSqlState.invoke(sqlca, (Object[]) null).toString(); builder.append(msg).append(" SQL Code: ").append(sqlCode).append(", SQL State: ").append(sqlState); return builder.toString(); }  boolean formatsException(Throwable t); String format(Throwable t); static final String JCC_EXCEPTION_PREFIX; static final String JCC_EXCEPTION_CLASS; }### Answer:
@Test public void testFormatJccException() throws Exception { SqlException testException = new SqlException(TEST_MESSAGE, TEST_CODE, TEST_STATE); String formattedMessage = classUnderTest.format(testException); System.err.println("Formatted message = "+formattedMessage); assertTrue(formattedMessage.contains(formattedMessage)); assertTrue(formattedMessage.contains(""+TEST_CODE)); assertTrue(formattedMessage.contains(""+TEST_STATE)); }