private static int getErrorCode(final int kernelCode, final int errorCode) {
        Preconditions.checkArgument(kernelCode >= 0 && kernelCode < 10, "The value range of kernel code should be [0, 10).");
        Preconditions.checkArgument(errorCode >= 0 && errorCode < 1000, "The value range of error code should be [0, 1000).");
        return kernelCode * 1000 + errorCode;
    }
@Test
    void assertToSQLExceptionWithCause() {
        Exception cause = new RuntimeException("test");
        SQLException actual = new KernelSQLException(XOpenSQLState.GENERAL_ERROR, 1, 1, cause, "reason") {
        }.toSQLException();
        assertThat(actual.getSQLState(), is(XOpenSQLState.GENERAL_ERROR.getValue()));
        assertThat(actual.getErrorCode(), is(11001));
        assertThat(actual.getMessage(), is("reason" + System.lineSeparator() + "More details: java.lang.RuntimeException: test"));
        assertThat(actual.getCause(), is(cause));
    }