public void testLookup() throws NotFoundException {
JavaSourceParser parser = new JavaSourceParser();
addGeneratedUnits(FOO);
addGeneratedUnits(BAR);
addGeneratedUnits(BAZ);
JClassType string = state.getTypeOracle().getType("java.lang.String");
JClassType foo = state.getTypeOracle().getType("test.Foo");
parser.addSourceForType(foo, FOO);
JClassType bar = state.getTypeOracle().getType("test.Bar");
parser.addSourceForType(bar, BAR);
JClassType baz = state.getTypeOracle().getType("test.Baz");
parser.addSourceForType(baz, BAZ);
JClassType baz1 = state.getTypeOracle().getType("test.Baz.Baz1");
JClassType baz2 = state.getTypeOracle().getType("test.Baz.Baz2");
JMethod method = foo.getMethod("value", new JType[]{
string, JPrimitiveType.INT});
String[] arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(2, arguments.length);
assertEquals("a", arguments[0]);
assertEquals("val", arguments[1]);
method = bar.getMethod("value", new JType[]{string, JPrimitiveType.INT});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(2, arguments.length);
assertEquals("a", arguments[0]);
assertEquals("val", arguments[1]);
method = bar.getMethod("value", new JType[]{JPrimitiveType.INT});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("val", arguments[0]);
method = bar.getMethod("value", new JType[]{string});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("a", arguments[0]);
method = baz1.getMethod("value", new JType[]{JPrimitiveType.INT});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("val", arguments[0]);
method = baz1.getMethod("value", new JType[]{string});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("a", arguments[0]);
method = baz2.getMethod("value", new JType[]{JPrimitiveType.INT});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("val", arguments[0]);
method = baz2.getMethod("value", new JType[]{string});
arguments = parser.getArguments(method);
assertNotNull(arguments);
assertEquals(1, arguments.length);
assertEquals("a", arguments[0]);
}