public void test_processSimpleFunction_nested_nested() throws Exception { // ## Arrange ## DerivedReferrerOption option = new DerivedReferrerOption(); option.acceptParameterKey("key", "path"); String sqbegin = SubQueryIndentProcessor.BEGIN_MARK_PREFIX; String sqend = SubQueryIndentProcessor.END_MARK_PREFIX; String identity = "identity"; StringBuilder sb = new StringBuilder(); sb.append("max(").append(sqbegin).append(identity); sb.append(ln()).append("select max(").append(sqbegin).append(identity); sb.append(ln()).append("select max(foo.COL)"); sb.append(ln()).append(" from FOO foo"); sb.append(ln()).append(")").append(sqend).append(identity); sb.append(ln()).append(" from FOO foo"); sb.append(ln()).append(")").append(sqend).append(identity); // ## Act ## String actual = option.processSimpleFunction(sb.toString(), "func", null, false, "param0"); // ## Assert ## log(ln() + actual); assertTrue(Srl.startsWith(actual, "func(max(" + sqbegin + identity)); assertTrue(Srl.contains(actual, "select max(foo.COL)")); assertTrue(Srl.contains(actual, " from FOO foo")); assertEquals(2, Srl.count(actual, "max(" + sqbegin + identity)); assertEquals(1, Srl.count(actual, "func(max(" + sqbegin + identity)); assertEquals(2, Srl.count(actual, ")" + sqend + identity)); assertEquals(1, Srl.count(actual, "/*pmb.path.key.bindMap.param0*/null)" + sqend + identity)); assertTrue(Srl.endsWith(actual, ", /*pmb.path.key.bindMap.param0*/null)" + sqend + identity)); }
public void test_processSimpleFunction_thirdArg() throws Exception { // ## Arrange ## DerivedReferrerOption option = new DerivedReferrerOption(); option.acceptParameterKey("key", "path"); // ## Act ## String actual = option.processSimpleFunction("max(foo.COL)", "func", "third", false, "param0"); // ## Assert ## log(actual); assertTrue(Srl.startsWith(actual, "func(max(foo.COL), ")); assertTrue(Srl.endsWith(actual, "/*pmb.path.key.bindMap.param0*/null, third)")); }