public static Optional<Cookie> findCookie(String cookieName, HttpRequest request) {
    Cookie[] cookies = request.getCookies();
    if (cookies == null) {
      return Optional.empty();
    }
    return Arrays.stream(cookies)
      .filter(cookie -> cookieName.equals(cookie.getName()))
      .findFirst();
  }
@Test
  public void does_not_fail_to_find_cookie_when_no_cookie() {
    assertThat(findCookie("unknown", request)).isEmpty();
  }