From 2eb246da205da899fd88238d1bc253f9809d9a2e Mon Sep 17 00:00:00 2001 From: rusher Date: Thu, 8 Feb 2024 15:46:16 +0100 Subject: [PATCH] [misc] set correct coverage goal --- codecov.yml | 2 +- .../jdbc/unit/util/log/LoggersTest.java | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index 2f716ceba..df35720f8 100644 --- a/codecov.yml +++ b/codecov.yml @@ -9,5 +9,5 @@ coverage: status: project: default: - target: auto + target: 85% # the required coverage value threshold: 1% diff --git a/src/test/java/org/mariadb/jdbc/unit/util/log/LoggersTest.java b/src/test/java/org/mariadb/jdbc/unit/util/log/LoggersTest.java index 994d11495..a81a08fc0 100644 --- a/src/test/java/org/mariadb/jdbc/unit/util/log/LoggersTest.java +++ b/src/test/java/org/mariadb/jdbc/unit/util/log/LoggersTest.java @@ -116,4 +116,43 @@ public void Slf4JLogger() throws IOException { reader.close(); } + + @Test + void noLoggerFactory() { + System.setProperty(Loggers.NO_LOGGER_PROPERTY, "true"); + Loggers.init(); + try { + Logger logger = Loggers.getLogger(LoggersTest.class); + assertFalse(logger.isErrorEnabled()); + assertFalse(logger.isWarnEnabled()); + assertFalse(logger.isInfoEnabled()); + assertFalse(logger.isDebugEnabled()); + assertFalse(logger.isTraceEnabled()); + assertEquals("", logger.getName()); + + logger.error("Test err1"); + logger.error("Test err2", new SQLException("test exception")); + logger.error("Test err3 {}", "param"); + + logger.warn("Test warn 1"); + logger.warn("Test warn 2", new SQLException("test exception")); + logger.warn("Test warn 3 {}", "param"); + + logger.info("Test info 1"); + logger.info("Test info 2", new SQLException("test exception")); + logger.info("Test info 3 {}", "param"); + + logger.debug("Test debug 1"); + logger.debug("Test debug 2", new SQLException("test exception")); + logger.debug("Test debug 3 {}", "param"); + + logger.trace("Test trace 1"); + logger.trace("Test trace 2", new SQLException("test exception")); + logger.trace("Test trace 3 {}", "param"); + + } finally { + System.clearProperty(Loggers.NO_LOGGER_PROPERTY); + Loggers.init(); + } + } }