You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/02 19:42:12 UTC

[tomcat] branch 7.0.x updated: Improve code coverage

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

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 301929b  Improve code coverage
301929b is described below

commit 301929b9ef4780f0605416e76489dcab96d5ed61
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 2 20:40:40 2020 +0100

    Improve code coverage
---
 .../apache/tomcat/util/res/TestStringManager.java    | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/util/res/TestStringManager.java b/test/org/apache/tomcat/util/res/TestStringManager.java
index 2a5bb96..7caeead 100644
--- a/test/org/apache/tomcat/util/res/TestStringManager.java
+++ b/test/org/apache/tomcat/util/res/TestStringManager.java
@@ -16,13 +16,15 @@
  */
 package org.apache.tomcat.util.res;
 
+import java.util.Locale;
+
 import org.junit.Assert;
 import org.junit.Test;
 
 public class TestStringManager {
 
-    private static final StringManager sm =
-        StringManager.getManager("org.apache.naming");
+    private static final String PACKAGE_NAME = "org.apache.tomcat.util";
+    private static final StringManager sm = StringManager.getManager(PACKAGE_NAME);
 
     @Test
     public void testNullKey() {
@@ -43,4 +45,18 @@ public class TestStringManager {
         sm.getString("namingContext.nameNotBound", (Object[]) null);
         sm.getString("namingContext.nameNotBound", new Object[1]);
     }
+
+    @Test
+    public void testFrench() {
+        StringManager sm = StringManager.getManager(PACKAGE_NAME, Locale.FRENCH);
+        Assert.assertEquals(Locale.FRENCH, sm.getLocale());
+    }
+
+    @Test
+    public void testMissing() {
+        Thread.currentThread().setContextClassLoader(TestStringManager.class.getClassLoader());
+        StringManager sm = StringManager.getManager("org.does.no.exist");
+        Assert.assertNull(sm.getLocale());
+    }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org