@Test public void testParseParamIdx() { Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("t**t")); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx(null)); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("")); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("1")); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("$$0")); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("$0$")); Assert.assertEquals(-1, ParamNodeParser.parseParamIdx("$10000000000000000000000000")); Assert.assertEquals(1, ParamNodeParser.parseParamIdx("$1")); Assert.assertEquals(0, ParamNodeParser.parseParamIdx("$0")); Assert.assertEquals(1, ParamNodeParser.parseParamIdx("$01")); }
static int parseParamIdx(String paramNodeValue) { if (!StringUtils.isEmpty(paramNodeValue)) { try { Matcher m = PARAM_PATTERN.matcher(paramNodeValue); if (m.matches()) { return Integer.parseInt(m.group(1)); } } catch (Throwable e) { logger.error("Failed to parse the value to get the parameter id.", e); } } return -1; }
ParamNodeParser { static int parseParamIdx(String paramNodeValue) { if (!StringUtils.isEmpty(paramNodeValue)) { try { Matcher m = PARAM_PATTERN.matcher(paramNodeValue); if (m.matches()) { return Integer.parseInt(m.group(1)); } } catch (Throwable e) { logger.error("Failed to parse the value to get the parameter id.", e); } } return -1; } }
ParamNodeParser { static int parseParamIdx(String paramNodeValue) { if (!StringUtils.isEmpty(paramNodeValue)) { try { Matcher m = PARAM_PATTERN.matcher(paramNodeValue); if (m.matches()) { return Integer.parseInt(m.group(1)); } } catch (Throwable e) { logger.error("Failed to parse the value to get the parameter id.", e); } } return -1; }  }
ParamNodeParser { static int parseParamIdx(String paramNodeValue) { if (!StringUtils.isEmpty(paramNodeValue)) { try { Matcher m = PARAM_PATTERN.matcher(paramNodeValue); if (m.matches()) { return Integer.parseInt(m.group(1)); } } catch (Throwable e) { logger.error("Failed to parse the value to get the parameter id.", e); } } return -1; }   }
ParamNodeParser { static int parseParamIdx(String paramNodeValue) { if (!StringUtils.isEmpty(paramNodeValue)) { try { Matcher m = PARAM_PATTERN.matcher(paramNodeValue); if (m.matches()) { return Integer.parseInt(m.group(1)); } } catch (Throwable e) { logger.error("Failed to parse the value to get the parameter id.", e); } } return -1; }    }