@Test public void testStringStringFunction() throws Exception { FunctionInterface fi = fff.getInstance(cl, "StringFunction"); fi.reset(); fi.insertOperand("indexOf"); fi.insertOperand("Apenoot"); fi.insertOperand("n"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); fi.reset(); fi.insertOperand("substring"); fi.insertOperand("Apenoot"); fi.insertOperand(new Integer(0)); fi.insertOperand(new Integer(4)); o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(String.class, o.getClass()); }
@Test public void testSize() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Size"); fi.reset(); fi.insertOperand("NOOT"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); assertEquals("4", o.toString()); fi.reset(); fi.insertOperand(createTestNavajo().getMessage("Aap")); o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); assertEquals("1", o.toString()); ArrayList<Integer> list = new ArrayList<Integer>(); list.add(new Integer(10)); list.add(new Integer(10)); fi.reset(); fi.insertOperand(list); o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); assertEquals("2", o.toString()); }
@Test public void testWait() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Wait"); fi.reset(); fi.insertOperand(new Integer(10)); Object o = fi.evaluateWithTypeChecking(); assertNull(o); }
@Test public void testNavajoRequestToString() throws Exception { Navajo n = createTestNavajo(); FunctionInterface fi = fff.getInstance(cl, "NavajoRequestToString"); fi.setInMessage(n); fi.reset(); Object o = fi.evaluate(); assertTrue(((String) o).indexOf("Aap") != -1); }
@Test public void testUnicode() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Unicode"); fi.reset(); fi.insertOperand("10"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); }
@Test public void testToBinaryFromPath() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToBinaryFromPath"); fi.reset(); fi.insertOperand("/aeap"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); }
@Test public void testToLower() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToLower"); fi.reset(); fi.insertOperand("AAP"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals("aap", o.toString()); }
@Test public void testToStopwatchTime() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToStopwatchTime"); fi.reset(); fi.insertOperand(new java.util.Date()); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(StopwatchTime.class, o.getClass()); }
@Test public void testToMemo() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToMemo"); fi.reset(); fi.insertOperand(new String("20")); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Memo.class, o.getClass()); }
@Test public void testToBinaryFromUrl() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToBinaryFromUrl"); fi.reset(); fi.insertOperand("http://www.google.com/google.jpg"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Binary.class, o.getClass()); }
@Test public void testXmlEscape() throws Exception { FunctionInterface fi = fff.getInstance(cl, "XmlEscape"); fi.reset(); fi.insertOperand("aap"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(o.getClass(), String.class); }
@Test public void testCurrentTimeMillis() throws Exception { FunctionInterface fi = fff.getInstance(cl, "CurrentTimeMillis"); fi.reset(); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(String.class, o.getClass()); }
@Test public void testCreateExpression() throws Exception { FunctionInterface fi = fff.getInstance(cl, "CreateExpression"); fi.reset(); fi.insertOperand("aap"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(String.class, o.getClass()); }
@Test public void testGetMimeType() throws Exception { FunctionInterface fi = fff.getInstance(cl, "GetMimeType"); fi.reset(); fi.insertOperand(null); Object o = fi.evaluateWithTypeChecking(); assertNull(o); }
@Test public void testEuro() throws Exception { DispatcherFactory df = new DispatcherFactory(new TestDispatcher(new TestNavajoConfig())); FunctionInterface fi = fff.getInstance(cl, "Euro"); fi.reset(); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); }
@Test public void testDecimalChar() throws Exception { FunctionInterface fi = fff.getInstance(cl, "DecimalChar"); fi.reset(); fi.insertOperand(10046); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(String.class, o.getClass()); }
@Test public void testCheckUrl() throws Exception { FunctionInterface fi = fff.getInstance(cl, "CheckUrl"); fi.reset(); fi.insertOperand("http://www.dexels.com"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Boolean.class, o.getClass()); }
@Test public void testToClockTime() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ToClockTime"); fi.reset(); fi.insertOperand("10:00"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals("10:00:00", o.toString()); assertEquals(ClockTime.class, o.getClass()); }
@Test public void testDate() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Date"); fi.reset(); fi.insertOperand("2008-01-01"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(java.util.Date.class, o.getClass()); }
@Test public void testGetUrlMimeType() throws Exception { FunctionInterface fi = fff.getInstance(cl, "GetUrlMimeType"); fi.reset(); fi.insertOperand("http://www.dexels.com/index.php"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); }
@Test public void testRandom() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Random"); fi.reset(); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); }
@Test public void testIsNull() throws Exception { FunctionInterface fi = fff.getInstance(cl, "IsNull"); fi.reset(); fi.insertOperand(null); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals("true", o.toString()); }
@Test public void testParseSelection() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ParseSelection"); fi.reset(); fi.insertOperand("aap,noot,mies"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertTrue(o.getClass().isArray()); }
@Test public void testGetCurrentMessage() throws Exception { FunctionInterface fi = fff.getInstance(cl, "GetCurrentMessage"); fi.reset(); fi.setInMessage(createTestNavajo()); Navajo doc = createTestNavajo(); Object o = fi.evaluateWithTypeChecking(); assertNull(o); }
@Test public void testZip() throws Exception { Binary b = new Binary(new byte[] {1, 1, 1}); FunctionInterface fi = fff.getInstance(cl, "Zip"); fi.reset(); fi.insertOperand(b); fi.insertOperand("aap"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(o.getClass(), Binary.class); }
@Test public void testExistsProperty() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ExistsProperty"); fi.reset(); fi.setInMessage(createTestNavajo()); fi.insertOperand("/Single/Selectie"); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals("true", o.toString()); }
@Test public void testAge() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Age"); fi.reset(); fi.setInMessage(createTestNavajo()); fi.insertOperand(new java.util.Date()); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Integer.class, o.getClass()); }
@Test public void testMergeNavajo() throws Exception { FunctionInterface fi = fff.getInstance(cl, "MergeNavajo"); fi.reset(); fi.insertOperand(createTestNavajo()); fi.insertOperand(createTestNavajo()); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertTrue(Navajo.class.isInstance(o)); }
@Test public void testParseStringList() throws Exception { FunctionInterface fi = fff.getInstance(cl, "ParseStringList"); fi.reset(); fi.insertOperand("aap,noot,mies"); fi.insertOperand(","); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertTrue(List.class.isInstance(o)); }
@Test public void testRound() throws Exception { FunctionInterface fi = fff.getInstance(cl, "Round"); fi.reset(); fi.insertOperand(new Double(10.5)); fi.insertOperand(0); Object o = fi.evaluateWithTypeChecking(); assertNotNull(o); assertEquals(Double.class, o.getClass()); }