@Test public void testNoBinding() { thrown.expect(PippoRuntimeException.class); thrown.expectMessage("No binding for '/contact/{id}'. Create binding with 'addUriPattern'"); uriMatcher.match("/contact/1", "/contact/{id}"); }
@Override public Map<String, String> match(String requestUri, String uriPattern) { UriPatternBinding binding = bindings.get(uriPattern); if (binding == null) { throw new PippoRuntimeException("No binding for '{}'. Create binding with 'addUriPattern'.", uriPattern); } return binding.getPattern().matcher(requestUri).matches() ? getParameters(binding, requestUri) : null; }
DefaultUriMatcher implements UriMatcher { @Override public Map<String, String> match(String requestUri, String uriPattern) { UriPatternBinding binding = bindings.get(uriPattern); if (binding == null) { throw new PippoRuntimeException("No binding for '{}'. Create binding with 'addUriPattern'.", uriPattern); } return binding.getPattern().matcher(requestUri).matches() ? getParameters(binding, requestUri) : null; } }
DefaultUriMatcher implements UriMatcher { @Override public Map<String, String> match(String requestUri, String uriPattern) { UriPatternBinding binding = bindings.get(uriPattern); if (binding == null) { throw new PippoRuntimeException("No binding for '{}'. Create binding with 'addUriPattern'.", uriPattern); } return binding.getPattern().matcher(requestUri).matches() ? getParameters(binding, requestUri) : null; } DefaultUriMatcher(); }
DefaultUriMatcher implements UriMatcher { @Override public Map<String, String> match(String requestUri, String uriPattern) { UriPatternBinding binding = bindings.get(uriPattern); if (binding == null) { throw new PippoRuntimeException("No binding for '{}'. Create binding with 'addUriPattern'.", uriPattern); } return binding.getPattern().matcher(requestUri).matches() ? getParameters(binding, requestUri) : null; } DefaultUriMatcher(); @Override Map<String, String> match(String requestUri, String uriPattern); @Override UriPatternBinding addUriPattern(String uriPattern); @Override UriPatternBinding removeUriPattern(String uriPattern); @Override String uriFor(String uriPattern, Map<String, Object> parameters); }
DefaultUriMatcher implements UriMatcher { @Override public Map<String, String> match(String requestUri, String uriPattern) { UriPatternBinding binding = bindings.get(uriPattern); if (binding == null) { throw new PippoRuntimeException("No binding for '{}'. Create binding with 'addUriPattern'.", uriPattern); } return binding.getPattern().matcher(requestUri).matches() ? getParameters(binding, requestUri) : null; } DefaultUriMatcher(); @Override Map<String, String> match(String requestUri, String uriPattern); @Override UriPatternBinding addUriPattern(String uriPattern); @Override UriPatternBinding removeUriPattern(String uriPattern); @Override String uriFor(String uriPattern, Map<String, Object> parameters);  }