Revision: 1322
          http://stripes.svn.sourceforge.net/stripes/?rev=1322&view=rev
Author:   bengunter
Date:     2010-11-10 20:18:37 +0000 (Wed, 10 Nov 2010)

Log Message:
-----------
In testValidateTypeConverter, the original type converter for Integer must be 
restored before the test exits.

Modified Paths:
--------------
    
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java

Modified: 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
===================================================================
--- 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
  2010-11-10 20:17:45 UTC (rev 1321)
+++ 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
  2010-11-10 20:18:37 UTC (rev 1322)
@@ -80,15 +80,25 @@
      * @see http://www.stripesframework.org/jira/browse/STS-610
      */
     @Test(groups="extensions")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public void testValidateTypeConverterExtendsStock() throws Exception {
         MockRoundtrip trip = new 
MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
-        
StripesFilter.getConfiguration().getTypeConverterFactory().add(Integer.class, 
MyIntegerTypeConverter.class);
-        trip.addParameter("shouldBeDoubled", "42");
-        trip.addParameter("shouldNotBeDoubled", "42");
-        trip.execute("validateTypeConverters");
-        ValidationAnnotationsTest actionBean = trip.getActionBean(getClass());
-        Assert.assertEquals(actionBean.shouldBeDoubled, new Integer(84));
-        Assert.assertEquals(actionBean.shouldNotBeDoubled, new Integer(42));
+        Locale locale = trip.getRequest().getLocale();
+        TypeConverterFactory factory = 
StripesFilter.getConfiguration().getTypeConverterFactory();
+        TypeConverter<?> tc = factory.getTypeConverter(Integer.class, locale);
+        try {
+            factory.add(Integer.class, MyIntegerTypeConverter.class);
+            trip.addParameter("shouldBeDoubled", "42");
+            trip.addParameter("shouldNotBeDoubled", "42");
+            trip.execute("validateTypeConverters");
+            ValidationAnnotationsTest actionBean = 
trip.getActionBean(getClass());
+            Assert.assertEquals(actionBean.shouldBeDoubled, new Integer(84));
+            Assert.assertEquals(actionBean.shouldNotBeDoubled, new 
Integer(42));
+        }
+        finally {
+            Class<? extends TypeConverter> tcType = tc == null ? null : 
tc.getClass();
+            factory.add(Integer.class, (Class<? extends TypeConverter<?>>) 
tcType);
+        }
     }
 
     /**


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Stripes-development mailing list
Stripes-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to