private boolean compareStackTraceElement(StackTraceElement obj1, StackTraceElement obj2) {
    return obj1.getClassName().equals(obj2.getClassName())
      && obj1.getLineNumber() == obj2.getLineNumber()
      && Objects.equals(obj1.getMethodName(), obj2.getMethodName())
      && Objects.equals(obj1.getFileName(), obj2.getFileName());
  }
Compare that a generic exception's stack trace has the same stack trace elements after
serialization and deserialization
hbase-server/src/test/java/org/apache/hadoop/hbase/errorhandling/TestForeignExceptionSerialization.java