@@ -0,0 +1,2541 @@
+/*%0A * Copyright Debezium Authors.%0A *%0A * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0%0A */%0Apackage io.debezium.connector.postgresql;%0A%0Aimport org.fest.assertions.Assertions;%0Aimport org.junit.Test;%0Aimport org.postgresql.util.PSQLException;%0Aimport org.postgresql.util.PSQLState;%0A%0Aimport io.debezium.DebeziumException;%0Aimport io.debezium.config.Configuration;%0Aimport io.debezium.connector.base.ChangeEventQueue;%0Aimport io.debezium.pipeline.DataChangeEvent;%0A%0Apublic class PostgresErrorHandlerTest %7B%0A    private static final String A_CLASSIFIED_EXCEPTION = %22Database connection failed when writing to copy%22;%0A%0A    private final PostgresErrorHandler errorHandler = new PostgresErrorHandler(%0A            new PostgresConnectorConfig(Configuration.create()%0A                    .with(PostgresConnectorConfig.SERVER_NAME, %22postgres%22)%0A                    .build()),%0A            new ChangeEventQueue.Builder%3CDataChangeEvent%3E().build());%0A%0A    @Test%0A    public void classifiedPSQLExceptionIsRetryable() %7B%0A        PSQLException testException = new PSQLException(A_CLASSIFIED_EXCEPTION, PSQLState.CONNECTION_FAILURE);%0A        Assertions.assertThat(errorHandler.isRetriable(testException)).isTrue();%0A    %7D%0A%0A    @Test%0A    public void psqlExceptionWithNullErrorMesdsageNotRetryable() %7B%0A        PSQLException testException = new PSQLException(null, PSQLState.CONNECTION_FAILURE);%0A        Assertions.assertThat(errorHandler.isRetriable(testException)).isFalse();%0A    %7D%0A%0A    @Test%0A    public void nullThrowableIsNotRetryable() %7B%0A        Assertions.assertThat(errorHandler.isRetriable(null)).isFalse();%0A    %7D%0A%0A    @Test%0A    public void unclassifiedPSQLExceptionIsNotRetryable() %7B%0A        PSQLException testException = new PSQLException(%0A                %22definitely not a postgres error%22, PSQLState.CONNECTION_FAILURE);%0A        Assertions.assertThat(errorHandler.isRetriable(testException)).isFalse();%0A    %7D%0A%0A    @Test%0A    public void classifiedPSQLExceptionWrappedInDebeziumExceptionIsRetryable() %7B%0A        PSQLException psqlException = new PSQLException(A_CLASSIFIED_EXCEPTION, PSQLState.CONNECTION_FAILURE);%0A        DebeziumException testException = new DebeziumException(psqlException);%0A        Assertions.assertThat(errorHandler.isRetriable(testException)).isTrue();%0A    %7D%0A%0A    @Test%0A    public void randomUnhandledExceptionIsNotRetryable() %7B%0A        RuntimeException testException = new RuntimeException();%0A        Assertions.assertThat(errorHandler.isRetriable(testException)).isFalse();%0A    %7D%0A%7D%0A

Add tests to cover PostgresErrorHandler behaviour