diff --git a/.gitignore b/.gitignore index b1ead11..6b686f6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/ # Intellij IDEA .idea/ +out/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index cab3ba7..3e50de5 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,7 @@ dependencies { compile 'com.google.code.gson:gson:2.8.0' testCompile 'junit:junit:4.12' + testRuntimeOnly 'org.slf4j:slf4j-simple:1.7.25' deployerJars "org.apache.maven.wagon:wagon-ssh:2.2" } diff --git a/src/test/java/io/kamax/matrix/LoggingDependencyTest.java b/src/test/java/io/kamax/matrix/LoggingDependencyTest.java new file mode 100644 index 0000000..1e6bd73 --- /dev/null +++ b/src/test/java/io/kamax/matrix/LoggingDependencyTest.java @@ -0,0 +1,43 @@ +/* + * matrix-java-sdk - Matrix Client SDK for Java + * Copyright (C) 2017 Arne Augenstein + * + * https://max.kamax.io/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package io.kamax.matrix; + +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.helpers.NOPLoggerFactory; + +import java.net.URISyntaxException; + +/** + * A small test class, intended to verify that the logging framework has + * a suitable logging implementation. + */ +public class LoggingDependencyTest { + @Test + public void login() throws URISyntaxException { + if (LoggerFactory.getILoggerFactory() instanceof NOPLoggerFactory) { + Assert.fail("No logging implementation found, using fallback NOP logger"); + } + Logger logger = LoggerFactory.getLogger(""); + logger.info("If you see this info in the logger, everything is alright"); + } +}