[seam-commits] Seam SVN: r15018 - in branches/community/Seam_2_3: seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 7 15:49:47 EDT 2012


Author: manaRH
Date: 2012-08-07 15:49:47 -0400 (Tue, 07 Aug 2012)
New Revision: 15018

Modified:
   branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java
   branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/MockNavigationHandler.java
   branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
Log:
JBSEAM-4912

Modified: branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java	2012-08-07 17:05:50 UTC (rev 15017)
+++ branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/AbstractSeamTest.java	2012-08-07 19:49:47 UTC (rev 15018)
@@ -989,8 +989,8 @@
       servletContext = ServletLifecycle.getServletContext();
       
       // FactoryFinder cannot be reliably used, as something could have called getFactory sooner
-      //applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
-      applicationFactory = new MockApplicationFactory();
+      applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+      //applicationFactory = new MockApplicationFactory();
       
       application = applicationFactory.getApplication();
       conversationViewRootAttributes = new HashMap<String, Map>();

Modified: branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/MockNavigationHandler.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/MockNavigationHandler.java	2012-08-07 17:05:50 UTC (rev 15017)
+++ branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/mock/MockNavigationHandler.java	2012-08-07 19:49:47 UTC (rev 15018)
@@ -1,9 +1,13 @@
 package org.jboss.seam.mock;
 
-import javax.faces.application.NavigationHandler;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.application.ConfigurableNavigationHandler;
+import javax.faces.application.NavigationCase;
 import javax.faces.context.FacesContext;
 
-public class MockNavigationHandler extends NavigationHandler
+public class MockNavigationHandler extends ConfigurableNavigationHandler
 {
 
    @Override
@@ -12,4 +16,16 @@
 
    }
 
+   @Override
+   public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome)
+   {
+      return null;
+   }
+
+   @Override
+   public Map<String, Set<NavigationCase>> getNavigationCases()
+   {
+      return null;
+   }
+
 }

Modified: branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2012-08-07 17:05:50 UTC (rev 15017)
+++ branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2012-08-07 19:49:47 UTC (rev 15018)
@@ -8,6 +8,8 @@
 import javax.faces.component.UIOutput;
 import javax.faces.event.ValueChangeEvent;
 
+import junit.framework.Assert;
+
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.container.test.api.OverProtocol;
 import org.jboss.arquillian.junit.Arquillian;
@@ -59,11 +61,12 @@
             {
                supportedLocales.add(iter.next());
             }
-            assert supportedLocales.size() == 3;
-            assert supportedLocales.contains(Locale.CANADA_FRENCH);
-            assert supportedLocales.contains(Locale.ENGLISH);
-            assert supportedLocales.contains(Locale.FRANCE);
-            assert getFacesContext().getApplication().getDefaultLocale().equals(Locale.CANADA_FRENCH);
+
+            Assert.assertEquals(3, supportedLocales.size());
+            Assert.assertTrue( supportedLocales.contains(Locale.CANADA_FRENCH) );
+            Assert.assertTrue( supportedLocales.contains(Locale.ENGLISH) );
+            Assert.assertTrue( supportedLocales.contains(Locale.FRANCE) );
+            Assert.assertEquals(Locale.CANADA_FRENCH, getFacesContext().getApplication().getDefaultLocale());
             
             // why not? I guess be default locale means different things in different contexts (server vs user)
             //assert org.jboss.seam.international.Locale.instance().equals(Locale.CANADA_FRENCH);
@@ -72,54 +75,54 @@
             getFacesContext().getApplication().setDefaultLocale(Locale.ENGLISH);
             //getFacesContext().getApplication().setSupportedLocales(null);
             
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.getDefault());
+            Assert.assertEquals(Locale.getDefault(), org.jboss.seam.international.Locale.instance());
             
             LocaleSelector.instance().setLocale(Locale.UK);
             
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.UK);
+            Assert.assertEquals(Locale.UK, org.jboss.seam.international.Locale.instance());
           
             LocaleSelector.instance().setLocaleString(Locale.FRANCE.toString());
             
-            assert LocaleSelector.instance().getLanguage().equals(Locale.FRANCE.getLanguage());
-            assert LocaleSelector.instance().getCountry().equals(Locale.FRANCE.getCountry());
-            assert LocaleSelector.instance().getVariant().equals(Locale.FRANCE.getVariant());
+            Assert.assertEquals(Locale.FRANCE.getLanguage(), LocaleSelector.instance().getLanguage());
+            Assert.assertEquals(Locale.FRANCE.getCountry(), LocaleSelector.instance().getCountry());
+            Assert.assertEquals(Locale.FRANCE.getVariant(), LocaleSelector.instance().getVariant());
             
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.FRANCE);
-            assert LocaleSelector.instance().getLocaleString().equals(Locale.FRANCE.toString());
+            Assert.assertEquals(Locale.FRANCE, org.jboss.seam.international.Locale.instance());
+            Assert.assertEquals(Locale.FRANCE.toString(), LocaleSelector.instance().getLocaleString());
             
             LocaleSelector.instance().select();
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.FRANCE);
+            Assert.assertEquals(Locale.FRANCE, org.jboss.seam.international.Locale.instance());
             
             LocaleSelector.instance().selectLanguage(Locale.JAPANESE.getLanguage());
-            assert org.jboss.seam.international.Locale.instance().getLanguage().equals(Locale.JAPANESE.getLanguage());
+            Assert.assertEquals(Locale.JAPANESE.getLanguage(), org.jboss.seam.international.Locale.instance().getLanguage());
             
             ValueChangeEvent valueChangeEvent = new ValueChangeEvent(new UIOutput(), Locale.JAPANESE.toString(), Locale.TAIWAN.toString());
             LocaleSelector.instance().select(valueChangeEvent);
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.TAIWAN);
+            Assert.assertEquals(Locale.TAIWAN, LocaleSelector.instance().getLocale());
             
             Locale uk_posix = new Locale(Locale.UK.getLanguage(), Locale.UK.getCountry(), "POSIX");
             LocaleSelector.instance().setLocale(uk_posix);
             
-            assert org.jboss.seam.international.Locale.instance().equals(uk_posix);
-            assert LocaleSelector.instance().getLanguage().equals(uk_posix.getLanguage());
-            assert LocaleSelector.instance().getCountry().equals(uk_posix.getCountry());
-            assert LocaleSelector.instance().getVariant().equals(uk_posix.getVariant());
+            Assert.assertEquals(uk_posix, org.jboss.seam.international.Locale.instance());
+            Assert.assertEquals(uk_posix.getLanguage(), LocaleSelector.instance().getLanguage());
+            Assert.assertEquals(uk_posix.getCountry(), LocaleSelector.instance().getCountry());
+            Assert.assertEquals(uk_posix.getVariant(), LocaleSelector.instance().getVariant());
             
             LocaleSelector.instance().setLanguage(Locale.CHINA.getLanguage());
             LocaleSelector.instance().setCountry(Locale.CHINA.getCountry()); 
             LocaleSelector.instance().setVariant(null);
             
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.CHINA);
+            Assert.assertEquals(Locale.CHINA, org.jboss.seam.international.Locale.instance());
             
             LocaleSelector.instance().setLanguage(Locale.ITALIAN.getLanguage());
             LocaleSelector.instance().setCountry(null);            
             LocaleSelector.instance().setVariant(null);
             
-            assert org.jboss.seam.international.Locale.instance().equals(Locale.ITALIAN);
+            Assert.assertEquals(Locale.ITALIAN, org.jboss.seam.international.Locale.instance());
             
-            assert LocaleSelector.instance().getSupportedLocales().size() ==3;
-            assert LocaleSelector.instance().getSupportedLocales().get(2).getValue().equals(Locale.ENGLISH.toString());
-            assert LocaleSelector.instance().getSupportedLocales().get(2).getLabel().equals(Locale.ENGLISH.getDisplayName());
+            Assert.assertEquals(3, LocaleSelector.instance().getSupportedLocales().size());
+            Assert.assertEquals(Locale.ENGLISH.toString(), LocaleSelector.instance().getSupportedLocales().get(2).getValue() );
+            Assert.assertEquals(Locale.ENGLISH.getDisplayName(), LocaleSelector.instance().getSupportedLocales().get(2).getLabel() );
 
             boolean failed = false;
             try
@@ -130,7 +133,7 @@
             {
                failed = true;
             }
-            assert failed;
+            Assert.assertEquals(true, failed);
             
             // TODO Test cookie stuff (need to extend Mocks for this)
             



More information about the seam-commits mailing list