mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-26 13:50:48 +00:00
Update tests in common to use JUnit 6
Closes #47887 Signed-off-by: stianst <stianst@gmail.com>
This commit is contained in:
+4
-4
@@ -46,13 +46,13 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>hamcrest</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>hamcrest</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.keycloak.common;
|
package org.keycloak.common;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
@@ -15,16 +16,16 @@ import org.keycloak.common.profile.CommaSeparatedListProfileConfigResolver;
|
|||||||
import org.keycloak.common.profile.ProfileException;
|
import org.keycloak.common.profile.ProfileException;
|
||||||
import org.keycloak.common.profile.PropertiesProfileConfigResolver;
|
import org.keycloak.common.profile.PropertiesProfileConfigResolver;
|
||||||
|
|
||||||
import org.hamcrest.MatcherAssert;
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.Rule;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
import org.junit.rules.TemporaryFolder;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertThrows;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
public class ProfileTest {
|
public class ProfileTest {
|
||||||
|
|
||||||
@@ -34,15 +35,15 @@ public class ProfileTest {
|
|||||||
private static final Profile.Feature EXPERIMENTAL_FEATURE = Profile.Feature.DYNAMIC_SCOPES;
|
private static final Profile.Feature EXPERIMENTAL_FEATURE = Profile.Feature.DYNAMIC_SCOPES;
|
||||||
private static Profile.Feature DEPRECATED_FEATURE = Profile.Feature.LOGIN_V1;
|
private static Profile.Feature DEPRECATED_FEATURE = Profile.Feature.LOGIN_V1;
|
||||||
|
|
||||||
@Rule
|
@TempDir
|
||||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
public File temporaryFolder;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeAll
|
||||||
public static void beforeClass() {
|
public static void beforeClass() {
|
||||||
Assert.assertEquals(Profile.Feature.Type.DEFAULT, DEFAULT_FEATURE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.DEFAULT, DEFAULT_FEATURE.getType());
|
||||||
Assert.assertEquals(Profile.Feature.Type.DISABLED_BY_DEFAULT, DISABLED_BY_DEFAULT_FEATURE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.DISABLED_BY_DEFAULT, DISABLED_BY_DEFAULT_FEATURE.getType());
|
||||||
Assert.assertEquals(Profile.Feature.Type.PREVIEW, PREVIEW_FEATURE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.PREVIEW, PREVIEW_FEATURE.getType());
|
||||||
Assert.assertEquals(Profile.Feature.Type.EXPERIMENTAL, EXPERIMENTAL_FEATURE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.EXPERIMENTAL, EXPERIMENTAL_FEATURE.getType());
|
||||||
|
|
||||||
for (Profile.Feature feature : Profile.Feature.values()) {
|
for (Profile.Feature feature : Profile.Feature.values()) {
|
||||||
if (feature.getType().equals(Profile.Feature.Type.DEPRECATED)) {
|
if (feature.getType().equals(Profile.Feature.Type.DEPRECATED)) {
|
||||||
@@ -52,11 +53,11 @@ public class ProfileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DEPRECATED_FEATURE != null) {
|
if (DEPRECATED_FEATURE != null) {
|
||||||
Assert.assertEquals(Profile.Feature.Type.DEPRECATED, DEPRECATED_FEATURE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.DEPRECATED, DEPRECATED_FEATURE.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void afterTest() {
|
public void afterTest() {
|
||||||
Profile.defaults();
|
Profile.defaults();
|
||||||
}
|
}
|
||||||
@@ -65,30 +66,30 @@ public class ProfileTest {
|
|||||||
public void checkDefaults() {
|
public void checkDefaults() {
|
||||||
Profile profile = Profile.defaults();
|
Profile profile = Profile.defaults();
|
||||||
|
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
||||||
Assert.assertFalse(DEFAULT_FEATURE.isDeprecated());
|
Assertions.assertFalse(DEFAULT_FEATURE.isDeprecated());
|
||||||
MatcherAssert.assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(DEFAULT_FEATURE)));
|
assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(DEFAULT_FEATURE)));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
Assert.assertFalse(DISABLED_BY_DEFAULT_FEATURE.isDeprecated());
|
Assertions.assertFalse(DISABLED_BY_DEFAULT_FEATURE.isDeprecated());
|
||||||
MatcherAssert.assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(DISABLED_BY_DEFAULT_FEATURE)));
|
assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(DISABLED_BY_DEFAULT_FEATURE)));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
||||||
Assert.assertFalse(EXPERIMENTAL_FEATURE.isDeprecated());
|
Assertions.assertFalse(EXPERIMENTAL_FEATURE.isDeprecated());
|
||||||
MatcherAssert.assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(EXPERIMENTAL_FEATURE)));
|
assertThat(profile.getPreviewFeatures(), Matchers.not(Matchers.hasItem(EXPERIMENTAL_FEATURE)));
|
||||||
if (DEPRECATED_FEATURE != null) {
|
if (DEPRECATED_FEATURE != null) {
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
||||||
MatcherAssert.assertThat(profile.getDeprecatedFeatures(), Matchers.hasItem(DEPRECATED_FEATURE));
|
assertThat(profile.getDeprecatedFeatures(), Matchers.hasItem(DEPRECATED_FEATURE));
|
||||||
Assert.assertTrue(DEPRECATED_FEATURE.isDeprecated());
|
Assertions.assertTrue(DEPRECATED_FEATURE.isDeprecated());
|
||||||
} else {
|
} else {
|
||||||
MatcherAssert.assertThat(profile.getDeprecatedFeatures(), Matchers.empty());
|
assertThat(profile.getDeprecatedFeatures(), Matchers.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(Profile.ProfileName.DEFAULT, profile.getName());
|
Assertions.assertEquals(Profile.ProfileName.DEFAULT, profile.getName());
|
||||||
|
|
||||||
MatcherAssert.assertThat(profile.getDisabledFeatures(), Matchers.hasItem(DISABLED_BY_DEFAULT_FEATURE));
|
assertThat(profile.getDisabledFeatures(), Matchers.hasItem(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
MatcherAssert.assertThat(profile.getPreviewFeatures(), Matchers.hasItem(PREVIEW_FEATURE));
|
assertThat(profile.getPreviewFeatures(), Matchers.hasItem(PREVIEW_FEATURE));
|
||||||
Assert.assertTrue(Profile.Feature.TOKEN_EXCHANGE.isDeprecated());
|
Assertions.assertTrue(Profile.Feature.TOKEN_EXCHANGE.isDeprecated());
|
||||||
Assert.assertEquals(Profile.Feature.Type.PREVIEW, Profile.Feature.TOKEN_EXCHANGE.getType());
|
Assertions.assertEquals(Profile.Feature.Type.PREVIEW, Profile.Feature.TOKEN_EXCHANGE.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -96,7 +97,7 @@ public class ProfileTest {
|
|||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty("keycloak.profile.feature.account_api", "disabled");
|
properties.setProperty("keycloak.profile.feature.account_api", "disabled");
|
||||||
|
|
||||||
Assert.assertEquals("Feature account-v3 depends on disabled feature account-api",
|
Assertions.assertEquals("Feature account-v3 depends on disabled feature account-api",
|
||||||
assertThrows(ProfileException.class,
|
assertThrows(ProfileException.class,
|
||||||
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
||||||
}
|
}
|
||||||
@@ -107,8 +108,8 @@ public class ProfileTest {
|
|||||||
properties.setProperty("keycloak.profile.feature.account", "disabled");
|
properties.setProperty("keycloak.profile.feature.account", "disabled");
|
||||||
properties.setProperty("keycloak.profile.feature.account_api", "disabled");
|
properties.setProperty("keycloak.profile.feature.account_api", "disabled");
|
||||||
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(Profile.Feature.ACCOUNT_V3));
|
Assertions.assertFalse(Profile.isFeatureEnabled(Profile.Feature.ACCOUNT_V3));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(Profile.Feature.ACCOUNT_API));
|
Assertions.assertFalse(Profile.isFeatureEnabled(Profile.Feature.ACCOUNT_API));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -116,7 +117,7 @@ public class ProfileTest {
|
|||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty("keycloak.profile.feature.account_api", "invalid");
|
properties.setProperty("keycloak.profile.feature.account_api", "invalid");
|
||||||
|
|
||||||
Assert.assertEquals("Invalid config value 'invalid' for feature key keycloak.profile.feature.account_api",
|
Assertions.assertEquals("Invalid config value 'invalid' for feature key keycloak.profile.feature.account_api",
|
||||||
assertThrows(ProfileException.class,
|
assertThrows(ProfileException.class,
|
||||||
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ public class ProfileTest {
|
|||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty("keycloak.profile", "experimental");
|
properties.setProperty("keycloak.profile", "experimental");
|
||||||
|
|
||||||
Assert.assertEquals("Invalid profile 'experimental' specified via 'keycloak.profile' property",
|
Assertions.assertEquals("Invalid profile 'experimental' specified via 'keycloak.profile' property",
|
||||||
assertThrows(ProfileException.class,
|
assertThrows(ProfileException.class,
|
||||||
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
() -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage());
|
||||||
}
|
}
|
||||||
@@ -137,16 +138,16 @@ public class ProfileTest {
|
|||||||
properties.setProperty("keycloak.profile", "preview");
|
properties.setProperty("keycloak.profile", "preview");
|
||||||
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
||||||
|
|
||||||
Assert.assertEquals(Profile.ProfileName.PREVIEW, Profile.getInstance().getName());
|
Assertions.assertEquals(Profile.ProfileName.PREVIEW, Profile.getInstance().getName());
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void enablePreviewWithCommaSeparatedList() {
|
public void enablePreviewWithCommaSeparatedList() {
|
||||||
Profile.configure(new CommaSeparatedListProfileConfigResolver("preview", null));
|
Profile.configure(new CommaSeparatedListProfileConfigResolver("preview", null));
|
||||||
|
|
||||||
Assert.assertEquals(Profile.ProfileName.PREVIEW, Profile.getInstance().getName());
|
Assertions.assertEquals(Profile.ProfileName.PREVIEW, Profile.getInstance().getName());
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -159,20 +160,20 @@ public class ProfileTest {
|
|||||||
String disabledFeatures = DEFAULT_FEATURE.getKey();
|
String disabledFeatures = DEFAULT_FEATURE.getKey();
|
||||||
Profile.configure(new CommaSeparatedListProfileConfigResolver(enabledFeatures, disabledFeatures));
|
Profile.configure(new CommaSeparatedListProfileConfigResolver(enabledFeatures, disabledFeatures));
|
||||||
|
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
||||||
if (DEPRECATED_FEATURE != null) {
|
if (DEPRECATED_FEATURE != null) {
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testKeys() {
|
public void testKeys() {
|
||||||
Assert.assertEquals("account-v3", Profile.Feature.ACCOUNT_V3.getKey());
|
Assertions.assertEquals("account-v3", Profile.Feature.ACCOUNT_V3.getKey());
|
||||||
Assert.assertEquals("account", Profile.Feature.ACCOUNT_V3.getUnversionedKey());
|
Assertions.assertEquals("account", Profile.Feature.ACCOUNT_V3.getUnversionedKey());
|
||||||
Assert.assertEquals("account:v3", Profile.Feature.ACCOUNT_V3.getVersionedKey());
|
Assertions.assertEquals("account:v3", Profile.Feature.ACCOUNT_V3.getVersionedKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -185,12 +186,12 @@ public class ProfileTest {
|
|||||||
String disabledFeatures = DEFAULT_FEATURE.getUnversionedKey();
|
String disabledFeatures = DEFAULT_FEATURE.getUnversionedKey();
|
||||||
Profile.configure(new CommaSeparatedListProfileConfigResolver(enabledFeatures, disabledFeatures));
|
Profile.configure(new CommaSeparatedListProfileConfigResolver(enabledFeatures, disabledFeatures));
|
||||||
|
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
||||||
if (DEPRECATED_FEATURE != null) {
|
if (DEPRECATED_FEATURE != null) {
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,12 +230,12 @@ public class ProfileTest {
|
|||||||
|
|
||||||
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
||||||
|
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
Assertions.assertFalse(Profile.isFeatureEnabled(DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(EXPERIMENTAL_FEATURE));
|
||||||
if (DEPRECATED_FEATURE != null) {
|
if (DEPRECATED_FEATURE != null) {
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DEPRECATED_FEATURE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,8 +246,8 @@ public class ProfileTest {
|
|||||||
|
|
||||||
Profile.configure(new CommaSeparatedListProfileConfigResolver(DISABLED_BY_DEFAULT_FEATURE.getKey(), ""), new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new CommaSeparatedListProfileConfigResolver(DISABLED_BY_DEFAULT_FEATURE.getKey(), ""), new PropertiesProfileConfigResolver(properties));
|
||||||
|
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(DISABLED_BY_DEFAULT_FEATURE));
|
||||||
Assert.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
Assertions.assertTrue(Profile.isFeatureEnabled(PREVIEW_FEATURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -256,18 +257,18 @@ public class ProfileTest {
|
|||||||
try {
|
try {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(PropertiesProfileConfigResolver.getPropertyKey(Profile.Feature.KERBEROS), "enabled");
|
properties.setProperty(PropertiesProfileConfigResolver.getPropertyKey(Profile.Feature.KERBEROS), "enabled");
|
||||||
ProfileException e = Assert.assertThrows(ProfileException.class, () -> Profile.configure(new PropertiesProfileConfigResolver(properties)));
|
ProfileException e = Assertions.assertThrows(ProfileException.class, () -> Profile.configure(new PropertiesProfileConfigResolver(properties)));
|
||||||
Assert.assertEquals("Feature kerberos cannot be enabled as it is not available.", e.getMessage());
|
Assertions.assertEquals("Feature kerberos cannot be enabled as it is not available.", e.getMessage());
|
||||||
|
|
||||||
Profile.defaults();
|
Profile.defaults();
|
||||||
properties.setProperty(PropertiesProfileConfigResolver.getPropertyKey(Profile.Feature.KERBEROS), "disabled");
|
properties.setProperty(PropertiesProfileConfigResolver.getPropertyKey(Profile.Feature.KERBEROS), "disabled");
|
||||||
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(Profile.Feature.KERBEROS));
|
Assertions.assertFalse(Profile.isFeatureEnabled(Profile.Feature.KERBEROS));
|
||||||
|
|
||||||
Profile.defaults();
|
Profile.defaults();
|
||||||
properties.clear();
|
properties.clear();
|
||||||
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
Profile.configure(new PropertiesProfileConfigResolver(properties));
|
||||||
Assert.assertFalse(Profile.isFeatureEnabled(Profile.Feature.KERBEROS));
|
Assertions.assertFalse(Profile.isFeatureEnabled(Profile.Feature.KERBEROS));
|
||||||
} finally {
|
} finally {
|
||||||
if (removed != null) {
|
if (removed != null) {
|
||||||
Security.insertProviderAt(removed.getValue(), removed.getKey());
|
Security.insertProviderAt(removed.getValue(), removed.getKey());
|
||||||
@@ -276,7 +277,7 @@ public class ProfileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void assertEquals(Set<Profile.Feature> actual, Collection<Profile.Feature> expected) {
|
public static void assertEquals(Set<Profile.Feature> actual, Collection<Profile.Feature> expected) {
|
||||||
MatcherAssert.assertThat(actual, Matchers.equalTo(expected));
|
assertThat(actual, Matchers.equalTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertEquals(Set<Profile.Feature> actual, Profile.Feature... expected) {
|
public static void assertEquals(Set<Profile.Feature> actual, Profile.Feature... expected) {
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
package org.keycloak.common.crypto;
|
package org.keycloak.common.crypto;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
public class CryptoIntegrationTest {
|
public class CryptoIntegrationTest {
|
||||||
private static CryptoProvider originalProvider;
|
private static CryptoProvider originalProvider;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeAll
|
||||||
public static void keepOriginalProvider() {
|
public static void keepOriginalProvider() {
|
||||||
CryptoIntegrationTest.originalProvider = getSelectedProvider();
|
CryptoIntegrationTest.originalProvider = getSelectedProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
// doing our best to avoid any side effects on other tests by restoring the initial state of CryptoIntegration
|
// doing our best to avoid any side effects on other tests by restoring the initial state of CryptoIntegration
|
||||||
@AfterClass
|
@AfterAll
|
||||||
public static void restoreOriginalProvider() {
|
public static void restoreOriginalProvider() {
|
||||||
CryptoIntegration.setProvider(originalProvider);
|
CryptoIntegration.setProvider(originalProvider);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package org.keycloak.common.enums;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class SslRequiredTest {
|
public class SslRequiredTest {
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ package org.keycloak.common.util;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.hamcrest.MatcherAssert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
@@ -75,28 +74,28 @@ public class Base64DecodeTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode(" ");
|
Base64.decode(" ");
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
assertThat(e, instanceOf(IllegalArgumentException.class));
|
assertThat(e, instanceOf(IllegalArgumentException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode(" ".getBytes());
|
Base64.decode(" ".getBytes());
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
assertThat(e, instanceOf(IllegalArgumentException.class));
|
assertThat(e, instanceOf(IllegalArgumentException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode((String) null);
|
Base64.decode((String) null);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
assertThat(e, instanceOf(NullPointerException.class));
|
assertThat(e, instanceOf(NullPointerException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode((byte[]) null);
|
Base64.decode((byte[]) null);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
assertThat(e, instanceOf(NullPointerException.class));
|
assertThat(e, instanceOf(NullPointerException.class));
|
||||||
}
|
}
|
||||||
@@ -106,28 +105,28 @@ public class Base64DecodeTest {
|
|||||||
public void decode_lowLevelInvalidParams() {
|
public void decode_lowLevelInvalidParams() {
|
||||||
try {
|
try {
|
||||||
Base64.decode(null, 0, 1, Base64.NO_OPTIONS);
|
Base64.decode(null, 0, 1, Base64.NO_OPTIONS);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e){
|
} catch (final Exception e){
|
||||||
assertThat(e, instanceOf(NullPointerException.class));
|
assertThat(e, instanceOf(NullPointerException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode(new byte[2], 0, 1, Base64.NO_OPTIONS);
|
Base64.decode(new byte[2], 0, 1, Base64.NO_OPTIONS);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e){
|
} catch (final Exception e){
|
||||||
assertThat(e, instanceOf(IllegalArgumentException.class));
|
assertThat(e, instanceOf(IllegalArgumentException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode(new byte[8], 0, 10, Base64.NO_OPTIONS);
|
Base64.decode(new byte[8], 0, 10, Base64.NO_OPTIONS);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e){
|
} catch (final Exception e){
|
||||||
assertThat(e, instanceOf(IllegalArgumentException.class));
|
assertThat(e, instanceOf(IllegalArgumentException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Base64.decode(new byte[8], 5, 5, Base64.NO_OPTIONS);
|
Base64.decode(new byte[8], 5, 5, Base64.NO_OPTIONS);
|
||||||
MatcherAssert.assertThat("Exception excepted", false);
|
assertThat("Exception excepted", false);
|
||||||
} catch (final Exception e){
|
} catch (final Exception e){
|
||||||
assertThat(e, instanceOf(IllegalArgumentException.class));
|
assertThat(e, instanceOf(IllegalArgumentException.class));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
@@ -18,7 +18,7 @@ public class CollectionUtilTest {
|
|||||||
public void joinInputNoneOutputEmpty() {
|
public void joinInputNoneOutputEmpty() {
|
||||||
final ArrayList<String> strings = new ArrayList<>();
|
final ArrayList<String> strings = new ArrayList<>();
|
||||||
final String retval = CollectionUtil.join(strings, ",");
|
final String retval = CollectionUtil.join(strings, ",");
|
||||||
Assert.assertEquals("", retval);
|
Assertions.assertEquals("", retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -27,7 +27,7 @@ public class CollectionUtilTest {
|
|||||||
strings.add("foo");
|
strings.add("foo");
|
||||||
strings.add("bar");
|
strings.add("bar");
|
||||||
final String retval = CollectionUtil.join(strings, null);
|
final String retval = CollectionUtil.join(strings, null);
|
||||||
Assert.assertEquals("foonullbar", retval);
|
Assertions.assertEquals("foonullbar", retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -35,7 +35,7 @@ public class CollectionUtilTest {
|
|||||||
final ArrayList<String> strings = new ArrayList<>();
|
final ArrayList<String> strings = new ArrayList<>();
|
||||||
strings.add("foo");
|
strings.add("foo");
|
||||||
final String retval = CollectionUtil.join(strings, ",");
|
final String retval = CollectionUtil.join(strings, ",");
|
||||||
Assert.assertEquals("foo", retval);
|
Assertions.assertEquals("foo", retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -44,7 +44,7 @@ public class CollectionUtilTest {
|
|||||||
strings.add("foo");
|
strings.add("foo");
|
||||||
strings.add("bar");
|
strings.add("bar");
|
||||||
final String retval = CollectionUtil.join(strings, ",");
|
final String retval = CollectionUtil.join(strings, ",");
|
||||||
Assert.assertEquals("foo,bar", retval);
|
Assertions.assertEquals("foo,bar", retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -72,9 +72,9 @@ public class CollectionUtilTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void equalsCollectionTest() {
|
public void equalsCollectionTest() {
|
||||||
Assert.assertFalse(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 2), Arrays.asList(1, 3)));
|
Assertions.assertFalse(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 2), Arrays.asList(1, 3)));
|
||||||
Assert.assertFalse(CollectionUtil.collectionEquals(Arrays.asList("A", "C"), Arrays.asList("A", "C", "B")));
|
Assertions.assertFalse(CollectionUtil.collectionEquals(Arrays.asList("A", "C"), Arrays.asList("A", "C", "B")));
|
||||||
Assert.assertFalse(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 2, 3), Arrays.asList(1, 2, 3, 2)));
|
Assertions.assertFalse(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 2, 3), Arrays.asList(1, 2, 3, 2)));
|
||||||
Assert.assertTrue(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 3), Arrays.asList(3, 1, 3)));
|
Assertions.assertTrue(CollectionUtil.collectionEquals(Arrays.asList(1, 3, 3), Arrays.asList(3, 1, 3)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package org.keycloak.common.util;
|
package org.keycloak.common.util;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class HtmlUtilsTest {
|
public class HtmlUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void escapeAttribute() {
|
public void escapeAttribute() {
|
||||||
Assert.assertEquals("1<2", HtmlUtils.escapeAttribute("1<2"));
|
Assertions.assertEquals("1<2", HtmlUtils.escapeAttribute("1<2"));
|
||||||
Assert.assertEquals("2<3&&3>2", HtmlUtils.escapeAttribute("2<3&&3>2") );
|
Assertions.assertEquals("2<3&&3>2", HtmlUtils.escapeAttribute("2<3&&3>2") );
|
||||||
Assert.assertEquals("test", HtmlUtils.escapeAttribute("test"));
|
Assertions.assertEquals("test", HtmlUtils.escapeAttribute("test"));
|
||||||
Assert.assertEquals("'test'", HtmlUtils.escapeAttribute("\'test\'"));
|
Assertions.assertEquals("'test'", HtmlUtils.escapeAttribute("\'test\'"));
|
||||||
Assert.assertEquals(""test"", HtmlUtils.escapeAttribute("\"test\""));
|
Assertions.assertEquals(""test"", HtmlUtils.escapeAttribute("\"test\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class KeyUtilsTest {
|
public class KeyUtilsTest {
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ package org.keycloak.common.util;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rmartinc
|
* @author rmartinc
|
||||||
@@ -30,73 +30,73 @@ public class KeycloakUriBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
Assert.assertEquals("http://localhost:8080/path?attr1=value1&attr2=value2",
|
Assertions.assertEquals("http://localhost:8080/path?attr1=value1&attr2=value2",
|
||||||
KeycloakUriBuilder.fromUri("http://localhost:8080/path?attr1=value1&attr2=value2")
|
KeycloakUriBuilder.fromUri("http://localhost:8080/path?attr1=value1&attr2=value2")
|
||||||
.build().toString());
|
.build().toString());
|
||||||
|
|
||||||
Assert.assertEquals("http://localhost/path?attr1=value1&attr2=value2",
|
Assertions.assertEquals("http://localhost/path?attr1=value1&attr2=value2",
|
||||||
KeycloakUriBuilder.fromUri("http://localhost:80")
|
KeycloakUriBuilder.fromUri("http://localhost:80")
|
||||||
.path("path")
|
.path("path")
|
||||||
.queryParam("attr1", "value1")
|
.queryParam("attr1", "value1")
|
||||||
.queryParam("attr2", "value2")
|
.queryParam("attr2", "value2")
|
||||||
.build().toString());
|
.build().toString());
|
||||||
|
|
||||||
Assert.assertEquals("unknown://localhost:9000/path",
|
Assertions.assertEquals("unknown://localhost:9000/path",
|
||||||
KeycloakUriBuilder.fromUri("unknown://localhost:9000/path").build().toString());
|
KeycloakUriBuilder.fromUri("unknown://localhost:9000/path").build().toString());
|
||||||
|
|
||||||
Assert.assertEquals("https://localhost/path?attr1=value1",
|
Assertions.assertEquals("https://localhost/path?attr1=value1",
|
||||||
KeycloakUriBuilder.fromUri("https://{hostname}:443/path?attr1={value}")
|
KeycloakUriBuilder.fromUri("https://{hostname}:443/path?attr1={value}")
|
||||||
.build("localhost", "value1").toString());
|
.build("localhost", "value1").toString());
|
||||||
|
|
||||||
Assert.assertEquals("https://localhost:8443/path?attr1=value1",
|
Assertions.assertEquals("https://localhost:8443/path?attr1=value1",
|
||||||
KeycloakUriBuilder.fromUri("https://localhost:8443/path?attr1={value}")
|
KeycloakUriBuilder.fromUri("https://localhost:8443/path?attr1={value}")
|
||||||
.buildFromMap(Collections.singletonMap("value", "value1")).toString());
|
.buildFromMap(Collections.singletonMap("value", "value1")).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPort() {
|
public void testPort() {
|
||||||
Assert.assertEquals("https://localhost:8443/path", KeycloakUriBuilder.fromUri("https://localhost:8443/path").buildAsString());
|
Assertions.assertEquals("https://localhost:8443/path", KeycloakUriBuilder.fromUri("https://localhost:8443/path").buildAsString());
|
||||||
Assert.assertEquals("https://localhost:8443/path", KeycloakUriBuilder.fromUri("https://localhost:8443/path").preserveDefaultPort().buildAsString());
|
Assertions.assertEquals("https://localhost:8443/path", KeycloakUriBuilder.fromUri("https://localhost:8443/path").preserveDefaultPort().buildAsString());
|
||||||
|
|
||||||
Assert.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost:443/path").buildAsString());
|
Assertions.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost:443/path").buildAsString());
|
||||||
Assert.assertEquals("https://localhost:443/path", KeycloakUriBuilder.fromUri("https://localhost:443/path").preserveDefaultPort().buildAsString());
|
Assertions.assertEquals("https://localhost:443/path", KeycloakUriBuilder.fromUri("https://localhost:443/path").preserveDefaultPort().buildAsString());
|
||||||
|
|
||||||
Assert.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost:80/path").buildAsString());
|
Assertions.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost:80/path").buildAsString());
|
||||||
Assert.assertEquals("http://localhost:80/path", KeycloakUriBuilder.fromUri("http://localhost:80/path").preserveDefaultPort().buildAsString());
|
Assertions.assertEquals("http://localhost:80/path", KeycloakUriBuilder.fromUri("http://localhost:80/path").preserveDefaultPort().buildAsString());
|
||||||
|
|
||||||
// Port always preserved (even if preserverPort not specified) due the port 80 doesn't match "https" scheme
|
// Port always preserved (even if preserverPort not specified) due the port 80 doesn't match "https" scheme
|
||||||
Assert.assertEquals("https://localhost:80/path", KeycloakUriBuilder.fromUri("https://localhost:80/path").buildAsString());
|
Assertions.assertEquals("https://localhost:80/path", KeycloakUriBuilder.fromUri("https://localhost:80/path").buildAsString());
|
||||||
|
|
||||||
// Port not in the build URL when it was not specified in the original URL (even if preserverPort() is true)
|
// Port not in the build URL when it was not specified in the original URL (even if preserverPort() is true)
|
||||||
Assert.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost/path").buildAsString());
|
Assertions.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost/path").buildAsString());
|
||||||
Assert.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost/path").preserveDefaultPort().buildAsString());
|
Assertions.assertEquals("http://localhost/path", KeycloakUriBuilder.fromUri("http://localhost/path").preserveDefaultPort().buildAsString());
|
||||||
Assert.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost/path").buildAsString());
|
Assertions.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost/path").buildAsString());
|
||||||
Assert.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost/path").preserveDefaultPort().buildAsString());
|
Assertions.assertEquals("https://localhost/path", KeycloakUriBuilder.fromUri("https://localhost/path").preserveDefaultPort().buildAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTemplateAndNotTemplate() {
|
public void testTemplateAndNotTemplate() {
|
||||||
Assert.assertEquals("https://localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
||||||
"https://localhost:8443/{path}?key={query}#{fragment}").buildAsString("path", "query", "fragment"));
|
"https://localhost:8443/{path}?key={query}#{fragment}").buildAsString("path", "query", "fragment"));
|
||||||
Assert.assertEquals("https://localhost:8443/%7Bpath%7D?key=%7Bquery%7D#%7Bfragment%7D", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://localhost:8443/%7Bpath%7D?key=%7Bquery%7D#%7Bfragment%7D", KeycloakUriBuilder.fromUri(
|
||||||
"https://localhost:8443/{path}?key={query}#{fragment}", false).buildAsString());
|
"https://localhost:8443/{path}?key={query}#{fragment}", false).buildAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUserInfo() {
|
public void testUserInfo() {
|
||||||
Assert.assertEquals("https://user-info@localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://user-info@localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
||||||
"https://{userinfo}@localhost:8443/{path}?key={query}#{fragment}").buildAsString("user-info", "path", "query", "fragment"));
|
"https://{userinfo}@localhost:8443/{path}?key={query}#{fragment}").buildAsString("user-info", "path", "query", "fragment"));
|
||||||
Assert.assertEquals("https://user%20info%40%2F@localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://user%20info%40%2F@localhost:8443/path?key=query#fragment", KeycloakUriBuilder.fromUri(
|
||||||
"https://{userinfo}@localhost:8443/{path}?key={query}#{fragment}").buildAsString("user info@/", "path", "query", "fragment"));
|
"https://{userinfo}@localhost:8443/{path}?key={query}#{fragment}").buildAsString("user info@/", "path", "query", "fragment"));
|
||||||
Assert.assertEquals("https://user-info%E2%82%AC@localhost:8443", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://user-info%E2%82%AC@localhost:8443", KeycloakUriBuilder.fromUri(
|
||||||
"https://user-info%E2%82%AC@localhost:8443", false).buildAsString());
|
"https://user-info%E2%82%AC@localhost:8443", false).buildAsString());
|
||||||
Assert.assertEquals("https://user-info%E2%82%AC@localhost:8443", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("https://user-info%E2%82%AC@localhost:8443", KeycloakUriBuilder.fromUri(
|
||||||
"https://user-info€@localhost:8443", false).buildAsString());
|
"https://user-info€@localhost:8443", false).buildAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyHostname() {
|
public void testEmptyHostname() {
|
||||||
Assert.assertEquals("app.immich:///oauth-callback", KeycloakUriBuilder.fromUri(
|
Assertions.assertEquals("app.immich:///oauth-callback", KeycloakUriBuilder.fromUri(
|
||||||
"app.immich:///oauth-callback").buildAsString());
|
"app.immich:///oauth-callback").buildAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.keycloak.common.util;
|
package org.keycloak.common.util;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
public class KeystoreUtilTest {
|
public class KeystoreUtilTest {
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ package org.keycloak.common.util;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,19 +30,19 @@ import static org.junit.Assert.assertTrue;
|
|||||||
public class MultivaluedHashMapTest {
|
public class MultivaluedHashMapTest {
|
||||||
|
|
||||||
public <T, R> void equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(MultivaluedHashMap<T, R> map, MultivaluedHashMap<T, R> equalMap) {
|
public <T, R> void equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(MultivaluedHashMap<T, R> map, MultivaluedHashMap<T, R> equalMap) {
|
||||||
assertTrue(String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for the same object. \nmap: %s", map),
|
assertTrue(map.equalsIgnoreValueOrder(map),
|
||||||
map.equalsIgnoreValueOrder(map));
|
String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for the same object. \nmap: %s", map));
|
||||||
assertTrue(String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for maps that are equal. \nmap1: %s \nmap2: %s", map, equalMap),
|
assertTrue(map.equalsIgnoreValueOrder(equalMap),
|
||||||
map.equalsIgnoreValueOrder(equalMap));
|
String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for maps that are equal. \nmap1: %s \nmap2: %s", map, equalMap));
|
||||||
assertTrue(String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for maps that are equal. \nmap1: %s \nmap2: %s", equalMap, map),
|
assertTrue(equalMap.equalsIgnoreValueOrder(map),
|
||||||
equalMap.equalsIgnoreValueOrder(map));
|
String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `true` for maps that are equal. \nmap1: %s \nmap2: %s", equalMap, map));
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, R> void equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(MultivaluedHashMap<T, R> map, MultivaluedHashMap<T, R> differentMap) {
|
public <T, R> void equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(MultivaluedHashMap<T, R> map, MultivaluedHashMap<T, R> differentMap) {
|
||||||
assertFalse(String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `false` for maps that are different. \nmap1: %s \nmap2: %s", map, differentMap),
|
assertFalse(map.equalsIgnoreValueOrder(differentMap),
|
||||||
map.equalsIgnoreValueOrder(differentMap));
|
String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `false` for maps that are different. \nmap1: %s \nmap2: %s", map, differentMap));
|
||||||
assertFalse(String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `false` for maps that are different. \nmap1: %s \nmap2: %s", differentMap, map),
|
assertFalse(differentMap.equalsIgnoreValueOrder(map),
|
||||||
differentMap.equalsIgnoreValueOrder(map));
|
String.format("MultivaluedHashMap.equalsIgnoreValueOrder() should return `false` for maps that are different. \nmap1: %s \nmap2: %s", differentMap, map));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
package org.keycloak.common.util;
|
package org.keycloak.common.util;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
@@ -29,11 +29,11 @@ public class PaddingUtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPadding() {
|
public void testPadding() {
|
||||||
Assert.assertEquals("foo123", PaddingUtils.padding("foo123", 5));
|
Assertions.assertEquals("foo123", PaddingUtils.padding("foo123", 5));
|
||||||
Assert.assertEquals("foo123", PaddingUtils.padding("foo123", 6));
|
Assertions.assertEquals("foo123", PaddingUtils.padding("foo123", 6));
|
||||||
Assert.assertEquals("foo123\0", PaddingUtils.padding("foo123", 7));
|
Assertions.assertEquals("foo123\0", PaddingUtils.padding("foo123", 7));
|
||||||
|
|
||||||
Assert.assertEquals("someLongPassword", PaddingUtils.padding("someLongPassword", 14));
|
Assertions.assertEquals("someLongPassword", PaddingUtils.padding("someLongPassword", 14));
|
||||||
Assert.assertEquals("short\0\0\0\0\0\0\0\0\0", PaddingUtils.padding("short", 14));
|
Assertions.assertEquals("short\0\0\0\0\0\0\0\0\0", PaddingUtils.padding("short", 14));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package org.keycloak.common.util;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class PathMatcherTest {
|
public class PathMatcherTest {
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ public class PathMatcherTest {
|
|||||||
public void keycloak15833Test() {
|
public void keycloak15833Test() {
|
||||||
TestingPathMatcher matcher = new TestingPathMatcher();
|
TestingPathMatcher matcher = new TestingPathMatcher();
|
||||||
|
|
||||||
Assert.assertEquals("/api/v1/1/campaigns/*/excelFiles", matcher.customBuildUriFromTemplate("/api/v1/{clientId}/campaigns/*/excelFiles", "/api/v1/1/contentConnectorConfigs/29/contentConnectorContents", false));
|
Assertions.assertEquals("/api/v1/1/campaigns/*/excelFiles", matcher.customBuildUriFromTemplate("/api/v1/{clientId}/campaigns/*/excelFiles", "/api/v1/1/contentConnectorConfigs/29/contentConnectorContents", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class TestingPathMatcher extends PathMatcher<Object> {
|
private static final class TestingPathMatcher extends PathMatcher<Object> {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ package org.keycloak.common.util;
|
|||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
@@ -32,44 +32,44 @@ public class StringPropertyReplacerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSystemProperties() throws NoSuchAlgorithmException {
|
public void testSystemProperties() throws NoSuchAlgorithmException {
|
||||||
System.setProperty("prop1", "val1");
|
System.setProperty("prop1", "val1");
|
||||||
Assert.assertEquals("foo-val1", replaceProperties("foo-${prop1}"));
|
Assertions.assertEquals("foo-val1", replaceProperties("foo-${prop1}"));
|
||||||
// non-matching scenarios
|
// non-matching scenarios
|
||||||
Assert.assertEquals("foo-${prop1", replaceProperties("foo-${prop1"));
|
Assertions.assertEquals("foo-${prop1", replaceProperties("foo-${prop1"));
|
||||||
Assert.assertEquals("foo-$prop1${", replaceProperties("foo-$prop1${"));
|
Assertions.assertEquals("foo-$prop1${", replaceProperties("foo-$prop1${"));
|
||||||
|
|
||||||
Assert.assertEquals("foo-def", replaceProperties("foo-${prop2:def}"));
|
Assertions.assertEquals("foo-def", replaceProperties("foo-${prop2:def}"));
|
||||||
System.setProperty("prop2", "val2");
|
System.setProperty("prop2", "val2");
|
||||||
Assert.assertEquals("foo-val2", replaceProperties("foo-${prop2:def}"));
|
Assertions.assertEquals("foo-val2", replaceProperties("foo-${prop2:def}"));
|
||||||
|
|
||||||
// nesting curly braces
|
// nesting curly braces
|
||||||
Assert.assertEquals("This is a default text with a {0} substitute", replaceProperties("${prop3:This is a default text with a {0} substitute}"));
|
Assertions.assertEquals("This is a default text with a {0} substitute", replaceProperties("${prop3:This is a default text with a {0} substitute}"));
|
||||||
// stops at first unmatched, then the rest is regular text - matches the original implementation
|
// stops at first unmatched, then the rest is regular text - matches the original implementation
|
||||||
Assert.assertEquals("This is a default text with a {0} substitute}", replaceProperties("${prop3:This is a default text with a {0}} substitute}"));
|
Assertions.assertEquals("This is a default text with a {0} substitute}", replaceProperties("${prop3:This is a default text with a {0}} substitute}"));
|
||||||
|
|
||||||
// It looks for the property "prop3", then fallback to "prop4", then fallback to "prop5" and finally default value.
|
// It looks for the property "prop3", then fallback to "prop4", then fallback to "prop5" and finally default value.
|
||||||
// This syntax is supported by Quarkus (and underlying Microprofile)
|
// This syntax is supported by Quarkus (and underlying Microprofile)
|
||||||
Assert.assertEquals("foo-def", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
Assertions.assertEquals("foo-def", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
||||||
System.setProperty("prop5", "val5");
|
System.setProperty("prop5", "val5");
|
||||||
Assert.assertEquals("foo-val5", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
Assertions.assertEquals("foo-val5", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
||||||
System.setProperty("prop4", "val4");
|
System.setProperty("prop4", "val4");
|
||||||
Assert.assertEquals("foo-val4", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
Assertions.assertEquals("foo-val4", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
||||||
System.setProperty("prop3", "val3");
|
System.setProperty("prop3", "val3");
|
||||||
Assert.assertEquals("foo-val3", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
Assertions.assertEquals("foo-val3", replaceProperties("foo-${prop3:${prop4:${prop5:def}}}"));
|
||||||
|
|
||||||
// It looks for the property "prop6", then fallback to "prop7" then fallback to value "def" .
|
// It looks for the property "prop6", then fallback to "prop7" then fallback to value "def" .
|
||||||
// This syntax is not supported by Quarkus (microprofile), however Wildfly probably supports this
|
// This syntax is not supported by Quarkus (microprofile), however Wildfly probably supports this
|
||||||
Assert.assertEquals("foo-def", replaceProperties("foo-${prop6,prop7:def}"));
|
Assertions.assertEquals("foo-def", replaceProperties("foo-${prop6,prop7:def}"));
|
||||||
System.setProperty("prop7", "val7");
|
System.setProperty("prop7", "val7");
|
||||||
Assert.assertEquals("foo-val7", replaceProperties("foo-${prop6,prop7:def}"));
|
Assertions.assertEquals("foo-val7", replaceProperties("foo-${prop6,prop7:def}"));
|
||||||
System.setProperty("prop6", "val6");
|
System.setProperty("prop6", "val6");
|
||||||
Assert.assertEquals("foo-val6", replaceProperties("foo-${prop6,prop7:def}"));
|
Assertions.assertEquals("foo-val6", replaceProperties("foo-${prop6,prop7:def}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStackOverflow() {
|
public void testStackOverflow() {
|
||||||
System.setProperty("prop", "${prop}");
|
System.setProperty("prop", "${prop}");
|
||||||
IllegalStateException ise = Assert.assertThrows(IllegalStateException.class, () -> replaceProperties("${prop}"));
|
IllegalStateException ise = Assertions.assertThrows(IllegalStateException.class, () -> replaceProperties("${prop}"));
|
||||||
Assert.assertEquals("Infinite recursion happening when replacing properties on '${prop}'", ise.getMessage());
|
Assertions.assertEquals("Infinite recursion happening when replacing properties on '${prop}'", ise.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -79,7 +79,7 @@ public class StringPropertyReplacerTest {
|
|||||||
for (Map.Entry<String, String> entry : env.entrySet()) {
|
for (Map.Entry<String, String> entry : env.entrySet()) {
|
||||||
String value = entry.getValue();
|
String value = entry.getValue();
|
||||||
if ( !(value == null || "".equals(value)) ) {
|
if ( !(value == null || "".equals(value)) ) {
|
||||||
Assert.assertEquals("foo-" + value, replaceProperties("foo-${env." + entry.getKey() + "}"));
|
Assertions.assertEquals("foo-" + value, replaceProperties("foo-${env." + entry.getKey() + "}"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.net.URI;
|
|||||||
|
|
||||||
import org.keycloak.common.util.StringSerialization.Deserializer;
|
import org.keycloak.common.util.StringSerialization.Deserializer;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.keycloak.common.util;
|
package org.keycloak.common.util;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
@@ -10,17 +10,17 @@ public class URLEncodingTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUrlEncoding() {
|
public void testUrlEncoding() {
|
||||||
Assert.assertEquals("some", Encode.urlEncode("some"));
|
Assertions.assertEquals("some", Encode.urlEncode("some"));
|
||||||
Assert.assertEquals("330cbb52-c3eb-4c4a-9f23-77a8094cd969", Encode.urlEncode("330cbb52-c3eb-4c4a-9f23-77a8094cd969"));
|
Assertions.assertEquals("330cbb52-c3eb-4c4a-9f23-77a8094cd969", Encode.urlEncode("330cbb52-c3eb-4c4a-9f23-77a8094cd969"));
|
||||||
Assert.assertEquals("sp%C3%A9cial.char", Encode.urlEncode("spécial.char"));
|
Assertions.assertEquals("sp%C3%A9cial.char", Encode.urlEncode("spécial.char"));
|
||||||
Assert.assertEquals("sp%C3%A9cial.ch%2Far.%C5%BE%C3%BD%C3%A1%C3%A1", Encode.urlEncode("spécial.ch/ar.žýáá"));
|
Assertions.assertEquals("sp%C3%A9cial.ch%2Far.%C5%BE%C3%BD%C3%A1%C3%A1", Encode.urlEncode("spécial.ch/ar.žýáá"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUrlDecoding() {
|
public void testUrlDecoding() {
|
||||||
Assert.assertEquals("some", Encode.urlDecode("some"));
|
Assertions.assertEquals("some", Encode.urlDecode("some"));
|
||||||
Assert.assertEquals("330cbb52-c3eb-4c4a-9f23-77a8094cd969", Encode.urlDecode("330cbb52-c3eb-4c4a-9f23-77a8094cd969"));
|
Assertions.assertEquals("330cbb52-c3eb-4c4a-9f23-77a8094cd969", Encode.urlDecode("330cbb52-c3eb-4c4a-9f23-77a8094cd969"));
|
||||||
Assert.assertEquals("spécial.char", Encode.urlDecode("sp%C3%A9cial.char"));
|
Assertions.assertEquals("spécial.char", Encode.urlDecode("sp%C3%A9cial.char"));
|
||||||
Assert.assertEquals("spécial.ch/ar.žýáá", Encode.urlDecode("sp%C3%A9cial.ch%2Far.%C5%BE%C3%BD%C3%A1%C3%A1"));
|
Assertions.assertEquals("spécial.ch/ar.žýáá", Encode.urlDecode("sp%C3%A9cial.ch%2Far.%C5%BE%C3%BD%C3%A1%C3%A1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
cd $(dirname $0)/../../
|
||||||
|
|
||||||
|
MODULE="$1"
|
||||||
|
|
||||||
|
cd "$MODULE"
|
||||||
|
|
||||||
|
../mvnw org.openrewrite.maven:rewrite-maven-plugin:run \
|
||||||
|
-Drewrite.activeRecipes=org.keycloak.JUnit4to5Migration \
|
||||||
|
-Drewrite.configLocation=../misc/rewrite/junit4-5.yml \
|
||||||
|
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:3.34.0
|
||||||
|
|
||||||
|
../mvnw spotless:apply
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
type: specs.openrewrite.org/v1beta/recipe
|
||||||
|
name: org.keycloak.JUnit4to5Migration
|
||||||
|
displayName: JUnit Jupiter migration from JUnit 4.x
|
||||||
|
description: |
|
||||||
|
Migrates JUnit 4.x tests to JUnit Jupiter.
|
||||||
|
recipeList:
|
||||||
|
- org.openrewrite.java.testing.junit5.IgnoreToDisabled
|
||||||
|
- org.openrewrite.maven.RemovePluginDependency:
|
||||||
|
pluginGroupId: org.apache.maven.plugins
|
||||||
|
pluginArtifactId: maven-surefire-plugin
|
||||||
|
groupId: org.apache.maven.surefire
|
||||||
|
artifactId: surefire-junit*
|
||||||
|
- org.openrewrite.java.testing.junit5.UpgradeSurefirePlugin
|
||||||
|
- org.openrewrite.java.testing.junit5.AddHamcrestJUnitDependency
|
||||||
|
- org.openrewrite.java.testing.junit5.UseHamcrestAssertThat
|
||||||
|
- org.openrewrite.java.testing.junit5.MigrateAssumptions
|
||||||
|
- org.openrewrite.java.ChangeMethodName:
|
||||||
|
methodPattern: org.junit.Assert assertEquals(.., Object[], Object[])
|
||||||
|
newMethodName: assertArrayEquals
|
||||||
|
- org.openrewrite.java.testing.junit5.AssertToAssertions
|
||||||
|
- org.openrewrite.java.testing.junit5.MigrateAssertionFailedError
|
||||||
|
- org.openrewrite.java.testing.junit5.CleanupJUnitImports
|
||||||
|
- org.openrewrite.java.testing.junit5.TemporaryFolderToTempDir
|
||||||
|
- org.openrewrite.java.testing.junit5.UpdateBeforeAfterAnnotations
|
||||||
|
- org.openrewrite.java.testing.junit5.UpdateTestAnnotation
|
||||||
|
- org.openrewrite.java.testing.junit5.ExpectedExceptionToAssertThrows
|
||||||
|
- org.openrewrite.java.testing.hamcrest.AddHamcrestIfUsed
|
||||||
|
- org.openrewrite.java.dependencies.RemoveDependency:
|
||||||
|
groupId: junit
|
||||||
|
artifactId: junit
|
||||||
|
- org.openrewrite.java.dependencies.AddDependency:
|
||||||
|
groupId: org.junit.jupiter
|
||||||
|
artifactId: junit-jupiter
|
||||||
|
scope: test
|
||||||
Reference in New Issue
Block a user