public void assertRoutes(Iterable<Route> expected, String path) { Iterator<RouteMatch> matches = matcher(path, Collections.<String, String[]>emptyMap()); List<Route> routes = new ArrayList<Route>(); while (matches.hasNext()) { routes.add(matches.next().getRoute()); } AbstractTestCase.assertEquals(expected, routes); }
public void assertRoutes(Iterable<Route> expected, String path) { Iterator<RouteMatch> matches = matcher(path, Collections.<String, String[]>emptyMap()); List<Route> routes = new ArrayList<Route>(); while (matches.hasNext()) { routes.add(matches.next().getRoute()); } AbstractTestCase.assertEquals(expected, routes); }
private ArrayList<Map<String, String>> foo(String path, Map<String, String> parameters) { // Convert HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // ArrayList<Map<String, String>> a = new ArrayList<Map<String, String>>(); while (result.hasNext()) { HashMap<String, String> actual = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : result.next().getMatched().entrySet()) { actual.put(entry.getKey().getName(), entry.getValue()); } a.add(actual); } // return a; }
private ArrayList<Map<String, String>> foo(String path, Map<String, String> parameters) { // Convert HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // ArrayList<Map<String, String>> a = new ArrayList<Map<String, String>>(); while (result.hasNext()) { HashMap<String, String> actual = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : result.next().getMatched().entrySet()) { actual.put(entry.getKey().getName(), entry.getValue()); } a.add(actual); } // return a; }
public Map<String, String> assertRoute(Route expectedRoute, String path, Map<String, String> parameters) { // HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // Assert.assertTrue(result.hasNext()); RouteMatch match = result.next(); Assert.assertSame(expectedRoute, match.getRoute()); // Map<String, String> ret = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : match.getMatched().entrySet()) { ret.put(entry.getKey().getName(), entry.getValue()); } // return ret; }
public Map<String, String> assertRoute(Route expectedRoute, String path, Map<String, String> parameters) { // HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // Assert.assertTrue(result.hasNext()); RouteMatch match = result.next(); Assert.assertSame(expectedRoute, match.getRoute()); // Map<String, String> ret = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : match.getMatched().entrySet()) { ret.put(entry.getKey().getName(), entry.getValue()); } // return ret; }