99import io .restassured .common .mapper .TypeRef ;
1010import io .restassured .http .ContentType ;
1111import org .junit .jupiter .api .*;
12+ import org .subethamail .wiser .Wiser ;
13+ import org .testcontainers .Testcontainers ;
1214import org .testcontainers .junit .jupiter .Container ;
1315import org .testcontainers .junit .jupiter .Testcontainers ;
1416
2729
2830@ Testcontainers
2931class KeycloakLoginAttributeProviderTest {
32+ private static final int SMTP_PORT = 2525 ;
33+
34+ static {
35+ Testcontainers .exposeHostPorts (SMTP_PORT );
36+ }
37+
3038 @ Container
3139 private static final KeycloakContainer KEYCLOAK_CONTAINER = new KeycloakContainer ()
3240 .withAdminUsername ("admin" )
@@ -36,18 +44,23 @@ class KeycloakLoginAttributeProviderTest {
3644 private static Playwright playwright ;
3745 private static Browser browser ;
3846 private static KeycloakEventsClient eventsClient ;
47+ private static Wiser smtpServer ;
3948 BrowserContext context ;
4049 Page page ;
4150
4251 @ BeforeAll
4352 static void launchBrowser () {
53+ smtpServer = new Wiser ();
54+ smtpServer .setPort (SMTP_PORT );
55+ smtpServer .start ();
4456 playwright = Playwright .create ();
4557 browser = playwright .chromium ().launch ();
4658 eventsClient = new KeycloakEventsClient (KEYCLOAK_CONTAINER , "testloginattribute" );
4759 }
4860
4961 @ AfterAll
5062 static void closeBrowser () {
63+ smtpServer .stop ();
5164 playwright .close ();
5265 }
5366
0 commit comments