public static Route getRoute( String method, String path, String action, String params, String headers, String sourceFile, int line) { Route route = new Route(); route.method = method; route.path = path.replace("//", "/"); route.action = action; route.routesFile = sourceFile; route.routesFileLine = line; route.addFormat(headers); route.addParams(params); route.compute(); if (Logger.isTraceEnabled()) { Logger.trace( "Adding [" + route.toString() + "] with params [" + params + "] and headers [" + headers + "]"); } return route; }
@Test public void path() throws Exception { new MockUnit(Route.class) .expect( unit -> { Route route = unit.get(Route.class); expect(route.path()).andReturn("/path"); }) .run( unit -> { assertEquals( "/path", new RequestMock() { @Override public Route route() { return unit.get(Route.class); } }.path()); }); }