You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2022/12/09 09:39:20 UTC

[commons-jcs] 02/02: Add some tests

This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit cda4f43fbf5684c9cf68b5f7d0c2593d80284c12
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Fri Dec 9 10:39:15 2022 +0100

    Add some tests
---
 .../jcs3/log/LogManagerNoLogSystemUnitTest.java    | 34 ++++++++++++++++++++
 .../commons/jcs3/log/LogManagerUnitTest.java       | 36 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerNoLogSystemUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerNoLogSystemUnitTest.java
new file mode 100644
index 00000000..422a2695
--- /dev/null
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerNoLogSystemUnitTest.java
@@ -0,0 +1,34 @@
+package org.apache.commons.jcs3.log;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.Test;
+
+public class LogManagerNoLogSystemUnitTest
+{
+    @Test(expected = ExceptionInInitializerError.class)
+    public void testLogFactoryNonExistingLogSystem()
+    {
+        // Set non-existing log system
+        LogManager.setLogSystem("test-logging");
+
+        LogManager.getLog(getClass());
+    }
+}
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerUnitTest.java
new file mode 100644
index 00000000..a45af509
--- /dev/null
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs3/log/LogManagerUnitTest.java
@@ -0,0 +1,36 @@
+package org.apache.commons.jcs3.log;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class LogManagerUnitTest
+{
+    @Test
+    public void testLogFactoryDefault()
+    {
+        // Set default log system
+        LogManager.setLogSystem(LogManager.LOGSYSTEM_JAVA_UTIL_LOGGING);
+
+        assertNotNull(LogManager.getLog(getClass()));
+    }
+}