Пример #1
0
  @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());
  }
Пример #2
0
  @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());
  }
Пример #3
0
  @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);
  }
Пример #4
0
 @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);
 }
Пример #5
0
  @Test
  public void testUnicode() throws Exception {

    FunctionInterface fi = fff.getInstance(cl, "Unicode");
    fi.reset();
    fi.insertOperand("10");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
  }
Пример #6
0
  @Test
  public void testToBinaryFromPath() throws Exception {

    FunctionInterface fi = fff.getInstance(cl, "ToBinaryFromPath");
    fi.reset();
    fi.insertOperand("/aeap");
    Object o = fi.evaluateWithTypeChecking();

    assertNotNull(o);
  }
Пример #7
0
  @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());
  }
Пример #8
0
  @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());
  }
Пример #9
0
  @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());
  }
Пример #10
0
  @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());
  }
Пример #11
0
  @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);
  }
Пример #12
0
  @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());
  }
Пример #13
0
  @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());
  }
Пример #14
0
  @Test
  public void testGetMimeType() throws Exception {

    FunctionInterface fi = fff.getInstance(cl, "GetMimeType");
    fi.reset();
    fi.insertOperand(null);

    Object o = fi.evaluateWithTypeChecking();

    assertNull(o);
  }
Пример #15
0
  @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);
  }
Пример #16
0
  @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());
  }
Пример #17
0
  @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());
  }
Пример #18
0
  @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());
  }
Пример #19
0
  @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());
  }
Пример #20
0
  @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);
  }
Пример #21
0
  @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());
  }
Пример #22
0
  @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());
  }
Пример #23
0
  @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());
  }
Пример #24
0
  @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);
  }
Пример #25
0
  @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);
  }
Пример #26
0
  @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());
  }
Пример #27
0
  @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());
  }
Пример #28
0
  @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));
  }
Пример #29
0
  @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));
  }
Пример #30
0
  @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());
  }