import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.keycloak.admin.client.Keycloak; import org.keycloak.representations.idm.RealmRepresentation; public class ExampleTest { @ClassRule public static KeycloakSuite server = KeycloakSuite.SERVER; @BeforeClass public static void commonSetup() { Keycloak keycloak = server.client(); //do setup here that is common to all tests in this class } @Test public void exampleTest() { Keycloak keycloak = server.client(); RealmRepresentation realm = keycloak.realm("master").toRepresentation(); assertThat(realm.getId(), is("master")); } }