From 21ddf5ef0543f709460ac005bfcd851b7b42260a Mon Sep 17 00:00:00 2001 From: Marco Collovati Date: Sat, 31 Aug 2024 14:11:58 +0200 Subject: [PATCH] test: fix flaky test based on current time --- .../vertx/vaadin/VertxVaadinResponseUT.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/vertx-vaadin-flow/src/test/java/com/github/mcollovati/vertx/vaadin/VertxVaadinResponseUT.java b/vertx-vaadin-flow/src/test/java/com/github/mcollovati/vertx/vaadin/VertxVaadinResponseUT.java index ef8e7e56..f1ee20f1 100644 --- a/vertx-vaadin-flow/src/test/java/com/github/mcollovati/vertx/vaadin/VertxVaadinResponseUT.java +++ b/vertx-vaadin-flow/src/test/java/com/github/mcollovati/vertx/vaadin/VertxVaadinResponseUT.java @@ -203,14 +203,26 @@ public void shouldDelegateAadCookie() throws Exception { ArgumentCaptor cookieCaptor = ArgumentCaptor.forClass(io.vertx.core.http.Cookie.class); verify(routingContext).addCookie(cookieCaptor.capture()); - String expectedCookie = io.vertx.core.http.Cookie.cookie(cookie.getName(), cookie.getValue()) + io.vertx.core.http.Cookie expectedCookie = io.vertx.core.http.Cookie.cookie(cookie.getName(), cookie.getValue()) .setMaxAge(cookie.getMaxAge()) .setSecure(cookie.getSecure()) .setHttpOnly(cookie.isHttpOnly()) .setPath(cookie.getPath()) - .setDomain(cookie.getDomain()) - .encode(); - assertThat(cookieCaptor.getValue().encode()).isEqualTo(expectedCookie); + .setDomain(cookie.getDomain()); + io.vertx.core.http.Cookie capturedCookie = cookieCaptor.getValue(); + assertThat(capturedCookie).extracting( + io.vertx.core.http.Cookie::getName, + io.vertx.core.http.Cookie::getMaxAge, + io.vertx.core.http.Cookie::getPath, + io.vertx.core.http.Cookie::getDomain, + io.vertx.core.http.Cookie::isSecure, + io.vertx.core.http.Cookie::isHttpOnly + ).containsExactly( + expectedCookie.getName(), expectedCookie.getMaxAge(), + expectedCookie.getPath(), expectedCookie.getDomain(), + expectedCookie.isSecure(), expectedCookie.isHttpOnly() + ): + } @Test