StepRequest { private String[] parseArguments(final int parameterStart, final String encoding) { final List<String> arguments = new ArrayList<String>(); int argStart = parameterStart; int nextArgStop = this.requestURI.indexOf('/', argStart); try { while (nextArgStop != -1) { arguments.add(URLDecoder.decode(this.requestURI.substring(argStart, nextArgStop), encoding)); argStart = nextArgStop + 1; nextArgStop = this.requestURI.indexOf('/', argStart); } } catch (final UnsupportedEncodingException e) { throw new StepInternalException(e.getMessage(), e); } if (argStart < this.requestURI.length()) { try { arguments.add(URLDecoder.decode(this.requestURI.substring(argStart), encoding)); } catch (final UnsupportedEncodingException e) { throw new StepInternalException("Unable to decode last argument", e); } } return arguments.toArray(new String[arguments.size()]); } StepRequest(final String requestURI, final String controllerName, final String methodName,
            final String[] args);  StepRequest(final HttpServletRequest request, final String encoding); ControllerCacheKey getCacheKey(); String getControllerName(); String getMethodName(); String[] getArgs(); @Override String toString(); boolean isExternal();  }
@Test public void testParseArguments() { final String stepRequest = "step-web/rest/bible/get/1K2/2K2/"; final HttpServletRequest req = mock(HttpServletRequest.class); when(req.getRequestURI()).thenReturn(stepRequest); when(req.getServletPath()).thenReturn("step-web/"); when(req.getContextPath()).thenReturn("rest/"); final StepRequest sr = new StepRequest(req, UTF_8_ENCODING); assertEquals(2, sr.getArgs().length); assertEquals("1K2", sr.getArgs()[0]); assertEquals("2K2", sr.getArgs()[1]); }