MCPcopy Create free account
hub / github.com/apache/pig / testStringInvoker

Method testStringInvoker

test/org/apache/pig/test/TestInvoker.java:45–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43 private final BagFactory bf_ = BagFactory.getInstance();
44
45 @Test
46 public void testStringInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
47
48 // Test non-static method
49 InvokeForString is = new InvokeForString("java.lang.String.toUpperCase", "String", "false");
50 assertEquals("FOO", is.exec(tf_.newTuple("foo")));
51
52 // both "static" and "true" should work
53 // Test static method
54 is = new InvokeForString("java.lang.String.valueOf", "int", "true");
55 Tuple t = tf_.newTuple(1);
56 t.set(0,231);
57 assertEquals("231", is.exec(t));
58
59 // test default (should be static)
60 is = new InvokeForString("java.lang.String.valueOf", "int");
61 assertEquals("231", is.exec(t));
62
63 // Test method with multiple args
64 is = new InvokeForString(TestInvoker.class.getName()+".concatStrings", "String String");
65 t = tf_.newTuple(2);
66 t.set(0, "foo");
67 t.set(1, "bar");
68 assertEquals("foobar", is.exec(t));
69 }
70
71 @Test
72 public void testNoArgInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {

Callers

nothing calls this directly

Calls 5

setMethod · 0.95
newTupleMethod · 0.65
assertEqualsMethod · 0.45
execMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected