BiConsumer 异常测试

时间:2021-03-19 10:49:01

标签: java code-coverage junit5

我如何测试代码覆盖率的异常。我可以模拟 Connection,但我不知道接下来要做什么

 private static final BiConsumer<PreparedStatement, Integer> INTEGER_CONSUMER
            = (PreparedStatement preparedStatement, Integer param) -> {
        try {
            preparedStatement.setInt(1, param);
        } catch (SQLException e) {
            throw new DBException(String.format(MESSAGE_FORMAT, "Integer consumer", FAILED_MESSAGE), e);
        }
    };

0 个答案:

没有答案
相关问题