Author: bvahdat
Date: Mon Feb 20 13:48:34 2012
New Revision: 1291256

URL: http://svn.apache.org/viewvc?rev=1291256&view=rev
Log:
Better ask for a mandatory conversion as otherwise a potentially failed 
conversion will not be detected.

Modified:
    
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java?rev=1291256&r1=1291255&r2=1291256&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
 Mon Feb 20 13:48:34 2012
@@ -22,6 +22,7 @@ import java.util.concurrent.ExecutorServ
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.impl.converter.StaticMethodTypeConverter;
 import org.apache.camel.util.StopWatch;
 
@@ -46,13 +47,18 @@ public class TypeConverterConcurrencyIss
             pool.submit(new Runnable() {
                 @Override
                 public void run() {
-                    context.getTypeConverter().convertTo(MyCamelBean.class, 
"1;MyCamel");
-                    latch.countDown();
+                    try {
+                        
context.getTypeConverter().mandatoryConvertTo(MyCamelBean.class, "1;MyCamel");
+                        latch.countDown();
+                    } catch (NoTypeConversionAvailableException e) {
+                        // ignore, as the latch will not be decremented 
anymore so that the assert below
+                        // will fail after the one minute timeout anyway
+                    }
                 }
             });
         }
         
-        assertTrue(latch.await(1, TimeUnit.MINUTES));
+        assertTrue("The expected mandatory conversions failed!", 
latch.await(1, TimeUnit.MINUTES));
         log.info("Took " + watch.stop() + " millis to convert " + size + " 
objects");
     }
     


Reply via email to