@Test(expected=NullPointerException.class) public void testLookupInvalidInput() throws Exception { final LookupRegistry<Object> matcher = new UriPatternMatcher<>(); matcher.lookup(null); }
@Override public synchronized T lookup(final String path) { Args.notNull(path, "Request path"); T obj = this.map.get(path); if (obj == null) { String bestMatch = null; for (final String pattern : this.map.keySet()) { if (matchUriRequestPattern(pattern, path)) { if (bestMatch == null || (bestMatch.length() < pattern.length()) || (bestMatch.length() == pattern.length() && pattern.endsWith("*"))) { obj = this.map.get(pattern); bestMatch = pattern; } } } } return obj; }
UriPatternMatcher implements LookupRegistry<T> { @Override public synchronized T lookup(final String path) { Args.notNull(path, "Request path"); T obj = this.map.get(path); if (obj == null) { String bestMatch = null; for (final String pattern : this.map.keySet()) { if (matchUriRequestPattern(pattern, path)) { if (bestMatch == null || (bestMatch.length() < pattern.length()) || (bestMatch.length() == pattern.length() && pattern.endsWith("*"))) { obj = this.map.get(pattern); bestMatch = pattern; } } } } return obj; } }
UriPatternMatcher implements LookupRegistry<T> { @Override public synchronized T lookup(final String path) { Args.notNull(path, "Request path"); T obj = this.map.get(path); if (obj == null) { String bestMatch = null; for (final String pattern : this.map.keySet()) { if (matchUriRequestPattern(pattern, path)) { if (bestMatch == null || (bestMatch.length() < pattern.length()) || (bestMatch.length() == pattern.length() && pattern.endsWith("*"))) { obj = this.map.get(pattern); bestMatch = pattern; } } } } return obj; } UriPatternMatcher(); }
UriPatternMatcher implements LookupRegistry<T> { @Override public synchronized T lookup(final String path) { Args.notNull(path, "Request path"); T obj = this.map.get(path); if (obj == null) { String bestMatch = null; for (final String pattern : this.map.keySet()) { if (matchUriRequestPattern(pattern, path)) { if (bestMatch == null || (bestMatch.length() < pattern.length()) || (bestMatch.length() == pattern.length() && pattern.endsWith("*"))) { obj = this.map.get(pattern); bestMatch = pattern; } } } } return obj; } UriPatternMatcher(); synchronized Set<Entry<String, T>> entrySet(); @Override synchronized void register(final String pattern, final T obj); @Override synchronized void unregister(final String pattern); @Override synchronized T lookup(final String path); @Override String toString(); }
UriPatternMatcher implements LookupRegistry<T> { @Override public synchronized T lookup(final String path) { Args.notNull(path, "Request path"); T obj = this.map.get(path); if (obj == null) { String bestMatch = null; for (final String pattern : this.map.keySet()) { if (matchUriRequestPattern(pattern, path)) { if (bestMatch == null || (bestMatch.length() < pattern.length()) || (bestMatch.length() == pattern.length() && pattern.endsWith("*"))) { obj = this.map.get(pattern); bestMatch = pattern; } } } } return obj; } UriPatternMatcher(); synchronized Set<Entry<String, T>> entrySet(); @Override synchronized void register(final String pattern, final T obj); @Override synchronized void unregister(final String pattern); @Override synchronized T lookup(final String path); @Override String toString();  }