camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r776286 - /camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java
Date Tue, 19 May 2009 11:56:57 GMT
Author: davsclaus
Date: Tue May 19 11:56:57 2009
New Revision: 776286

URL: http://svn.apache.org/viewvc?rev=776286&view=rev
Log:
CAMEL-1627: Added more operators to simple language: is and range.

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java?rev=776286&r1=776285&r2=776286&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleOperatorTest.java
Tue May 19 11:56:57 2009
@@ -235,6 +235,13 @@
 
         assertExpression("${in.header.foo} is String", true);
         assertExpression("${in.header.foo} is Integer", false);
+
+        try {
+            assertExpression("${in.header.foo} is com.mycompany.DoesNotExist", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
     }
 
     public void testIsNot() throws Exception {
@@ -246,6 +253,13 @@
 
         assertExpression("${in.header.foo} not is String", false);
         assertExpression("${in.header.foo} not is Integer", true);
+
+        try {
+            assertExpression("${in.header.foo} is not com.mycompany.DoesNotExist", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
     }
 
     public void testRange() throws Exception {
@@ -257,6 +271,34 @@
         assertExpression("${bean:generator.generateId} range 120..123", true);
         assertExpression("${bean:generator.generateId} range 120..122", false);
         assertExpression("${bean:generator.generateId} range 124..130", false);
+
+        try {
+            assertExpression("${in.header.foo} range abc..200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} range abc..", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} range 100 200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} range 100.200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
     }
 
     public void testNotRange() throws Exception {
@@ -268,6 +310,34 @@
         assertExpression("${bean:generator.generateId} not range 120..123", false);
         assertExpression("${bean:generator.generateId} not range 120..122", true);
         assertExpression("${bean:generator.generateId} not range 124..130", true);
+
+        try {
+            assertExpression("${in.header.foo} not range abc..200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} not range abc..", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} not range 100 200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
+
+        try {
+            assertExpression("${in.header.foo} not range 100.200", false);
+            fail("Should have thrown an exception");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().startsWith("Syntax error"));
+        }
     }
 
     protected String getLanguageName() {



Mime
View raw message