### Question:
Router implements Handler { public Router path(final String path, final Handler handler) { if ( path == null ) { throw new NullPointerException("null path"); } if ( handler == null ) { throw new NullPointerException("null handler"); } final Matcher matcher=PathPattern.matcher(path); if ( path.isEmpty() || !matcher.matches() ) { throw new IllegalArgumentException("malformed path <"+path+">"); } final String prefix=matcher.group("prefix"); final String suffix=matcher.group("suffix"); final Function<Request, Optional<Future<Response>>> route=route( prefix == null ? "" : prefix, suffix == null ? "" : suffix, handler ); if ( routes.putIfAbsent(path, route) != null ) { throw new IllegalStateException("path already mapped <"+path+">"); } return this; }  Router path(final String path, final Handler handler); @Override Future<Response> handle(final Request request);  }### Answer:
@Test void testCheckPaths() { assertThatExceptionOfType(IllegalArgumentException.class) .as("empty path") .isThrownBy(() -> new Router() .path("", handler()) ); assertThatExceptionOfType(IllegalArgumentException.class) .as("missing leading slash path") .isThrownBy(() -> new Router() .path("path", handler()) ); assertThatExceptionOfType(IllegalArgumentException.class) .as("malformed placeholder step") .isThrownBy(() -> new Router() .path("/pa{}th", handler()) ); assertThatExceptionOfType(IllegalArgumentException.class) .as("malformed prefix step") .isThrownBy(() -> new Router() .path("/pa*th", handler()) ); assertThatExceptionOfType(IllegalArgumentException.class) .as("inline prefix step") .isThrownBy(() -> new Router() .path("/*/path", handler()) ); assertThatExceptionOfType(IllegalStateException.class) .as("existing path") .isThrownBy(() -> new Router() .path("/path", handler()) .path("/path", handler()) ); }