HttpRequestMatchers { public static Matcher<HttpRequest> pathStartsWith(String pathPrefix) { if (pathPrefix == null) throw new NullPointerException("pathPrefix == null"); if (pathPrefix.isEmpty()) throw new NullPointerException("pathPrefix is empty"); return new PathStartsWith(pathPrefix); }  static Matcher<HttpRequest> methodEquals(String method); static Matcher<HttpRequest> pathStartsWith(String pathPrefix);  }
@Test public void pathStartsWith_matched_exact() { when(httpRequest.path()).thenReturn("/foo"); assertThat(pathStartsWith("/foo").matches(httpRequest)).isTrue(); }
@Test public void pathStartsWith_matched_prefix() { when(httpRequest.path()).thenReturn("/foo/bar"); assertThat(pathStartsWith("/foo").matches(httpRequest)).isTrue(); }
@Test public void pathStartsWith_unmatched() { when(httpRequest.path()).thenReturn("/fo"); assertThat(pathStartsWith("/foo").matches(httpRequest)).isFalse(); }
@Test public void pathStartsWith_unmatched_null() { assertThat(pathStartsWith("/foo").matches(httpRequest)).isFalse(); }