@Test
void throwsParserException() throws SQLException, IOException {

    // given
    CopyManager copyManager = mock(CopyManager.class);
    doThrow(SQLException.class).when(copyManager).copyIn(any(), (Reader) any(), anyInt());
    PGConnection pgConnection = mock(PGConnection.class);
    doReturn(copyManager).when(pgConnection).getCopyAPI();
    DataSource dataSource = mock(DataSource.class);
    Connection conn = mock(Connection.class);
    doReturn(conn).when(dataSource).getConnection();
    doReturn(pgConnection).when(conn).unwrap(any());
    var cryptoTransferPgCopy2 = new PgCopy<>(CryptoTransfer.class, meterRegistry, sqlProperties);
    var cryptoTransfers = new HashSet<CryptoTransfer>();
    cryptoTransfers.add(cryptoTransfer(1));
    // when
    assertThatThrownBy(() -> cryptoTransferPgCopy2.copy(cryptoTransfers, dataSource.getConnection()))
            .isInstanceOf(ParserException.class);
}