### Question:
MysqlMasterSlaveExceptionHandler implements
        MasterSlaveExceptionHandler { @Override public boolean isShouldRemove(Throwable throwable) { Throwable current = throwable; while (current != null) { if (current.getClass().getName().equals(JDBC_COMMUNICATIONS_EXCEPTION_NAME)) { return true; } if (current.getClass().getName().equals(JDBC_4_COMMUNICATIONS_EXCEPTION_NAME)) { return true; } current = current.getCause(); } return false; }  @Override boolean isShouldRemove(Throwable throwable);  }### Answer:
@Test public void test() { com.mysql.jdbc.CommunicationsException e = new com.mysql.jdbc.CommunicationsException(); assertTrue(handler.isShouldRemove(e)); assertTrue(handler.isShouldRemove(new RuntimeException(e))); assertTrue(handler.isShouldRemove(new RuntimeException(new SQLException(e)))); com.mysql.jdbc.exceptions.jdbc4.CommunicationsException e4 = new com.mysql.jdbc.exceptions.jdbc4.CommunicationsException(); assertTrue(handler.isShouldRemove(e4)); assertTrue(handler.isShouldRemove(new RuntimeException(e4))); assertTrue(handler.isShouldRemove(new RuntimeException(new SQLException(e4)))); assertFalse(handler.isShouldRemove(new RuntimeException())); assertFalse(handler.isShouldRemove(new RuntimeException(new SQLException()))); }