From 63ce4a6d720af6085aee9bf1eac849b3337769f3 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 14:56:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManagerTest.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index 1e16a1d7c9..2707d73dd5 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -2,6 +2,7 @@ package com.fr.design; import com.fr.invoke.Reflect; import junit.framework.TestCase; +import org.easymock.EasyMock; import java.util.Locale; @@ -20,8 +21,18 @@ public class DesignerEnvManagerTest extends TestCase{ } public void testCheckLocale() { - DesignerEnvManager envManager = new DesignerEnvManager(); - Locale checkLocale = Reflect.on(envManager).call("checkLocale", Locale.getDefault()).get(); - assertEquals(Locale.SIMPLIFIED_CHINESE, checkLocale); + DesignerEnvManager envManager = EasyMock.createMock(DesignerEnvManager.class); + Reflect on = Reflect.on(envManager); + + //验证zh-Hans-CN + Locale locale = Reflect.on(Locale.class).call("getInstance", "zh", "", "CN", "", null).get(); + assertEquals(Locale.SIMPLIFIED_CHINESE, locale); + + //验证其它语言 + assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", Locale.SIMPLIFIED_CHINESE).get()); + assertEquals(Locale.TRADITIONAL_CHINESE, on.call("checkLocale", Locale.TRADITIONAL_CHINESE).get()); + assertEquals(Locale.US, on.call("checkLocale", Locale.US).get()); + assertEquals(Locale.JAPAN, on.call("checkLocale", Locale.JAPAN).get()); + assertEquals(Locale.KOREA, on.call("checkLocale", Locale.KOREA).get()); } }