From 793cd71a5e7aa821220277d7c5d40b218ccbcfaf Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Fri, 9 Jul 2021 11:17:36 -0500 Subject: [PATCH] Remove remaining junit code --- .../jdbc/BasicLookupStrategyWithAclClassTypeTests.java | 10 +++++----- .../security/crypto/encrypt/CryptoAssumptions.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java index 63349e784e..2817c1023c 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java @@ -21,7 +21,6 @@ import java.util.Map; import javax.sql.DataSource; -import junit.framework.Assert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -37,6 +36,7 @@ import org.springframework.security.acls.domain.ObjectIdentityImpl; import org.springframework.security.acls.model.Acl; import org.springframework.security.acls.model.ObjectIdentity; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** @@ -99,8 +99,8 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS_WITH_UUID, OBJECT_IDENTITY_UUID); Map foundAcls = this.uuidEnabledStrategy.readAclsById(Arrays.asList(oid), Arrays.asList(BEN_SID)); - Assert.assertEquals(1, foundAcls.size()); - Assert.assertNotNull(foundAcls.get(oid)); + assertThat(foundAcls).hasSize(1); + assertThat(foundAcls.get(oid)).isNotNull(); } @Test @@ -108,8 +108,8 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, 100L); Map foundAcls = this.uuidEnabledStrategy.readAclsById(Arrays.asList(oid), Arrays.asList(BEN_SID)); - Assert.assertEquals(1, foundAcls.size()); - Assert.assertNotNull(foundAcls.get(oid)); + assertThat(foundAcls).hasSize(1); + assertThat(foundAcls.get(oid)).isNotNull(); } @Test diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java index 4ff573470e..40bedd7657 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java @@ -21,8 +21,8 @@ import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; -import org.junit.AssumptionViolatedException; import org.junit.jupiter.api.Assumptions; +import org.opentest4j.TestAbortedException; import org.springframework.security.crypto.encrypt.AesBytesEncryptor.CipherAlgorithm; @@ -46,10 +46,10 @@ public final class CryptoAssumptions { aes256Available = Cipher.getMaxAllowedKeyLength("AES") >= 256; } catch (NoSuchAlgorithmException ex) { - throw new AssumptionViolatedException(cipherAlgorithm + " not available, skipping test", ex); + throw new TestAbortedException(cipherAlgorithm + " not available, skipping test", ex); } catch (NoSuchPaddingException ex) { - throw new AssumptionViolatedException(cipherAlgorithm + " padding not available, skipping test", ex); + throw new TestAbortedException(cipherAlgorithm + " padding not available, skipping test", ex); } Assumptions.assumeTrue(aes256Available, "AES key length of 256 not allowed, skipping test"); }