You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2022/09/07 20:57:30 UTC

[sling-org-apache-sling-commons-crypto] 01/06: SLING-11475 Update Testing PaxExam to 4.0.0

This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-crypto.git

commit 0fe6ceaa0c7bf392ea841039307ff20e0afba258
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Sep 7 14:55:25 2022 +0200

    SLING-11475 Update Testing PaxExam to 4.0.0
    
    * use Testing PaxExam 4.0.0-SNAPSHOT
    * update test dependencies
    * use Hamcrest's assertThat
---
 pom.xml                                            | 41 ++++++----------------
 .../EnvironmentVariablePasswordProviderTest.java   |  9 ++---
 .../crypto/internal/FilePasswordProviderTest.java  | 23 ++++++------
 .../crypto/internal/PbeSecretKeyProviderTest.java  | 11 +++---
 .../internal/SecureRandomSaltProviderTest.java     |  9 ++---
 .../commons/crypto/it/tests/CryptoTestSupport.java | 29 ++-------------
 .../crypto/it/tests/EncryptWebConsolePluginIT.java | 27 +++++++-------
 .../EnvironmentVariablePasswordProviderIT.java     |  8 +++--
 .../crypto/it/tests/FilePasswordProviderIT.java    |  8 +++--
 .../crypto/it/tests/PbeSecretKeyProviderIT.java    | 10 +++---
 .../it/tests/SecureRandomSaltProviderIT.java       | 10 +++---
 .../JasyptStandardPbeStringCryptoServiceIT.java    |  8 +++--
 .../JasyptStandardPbeStringCryptoServiceTest.java  | 13 +++----
 .../internal/EncryptWebConsolePluginTest.java      |  5 +--
 14 files changed, 93 insertions(+), 118 deletions(-)

diff --git a/pom.xml b/pom.xml
index c9d88eb..5e408cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -213,14 +213,14 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>7.0.1</version>
+      <version>7.0.5</version>
       <scope>test</scope>
     </dependency>
     <!-- Apache Sling -->
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.testing.paxexam</artifactId>
-      <version>3.1.0</version>
+      <version>4.0.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -229,19 +229,6 @@
       <version>1.69</version>
       <scope>test</scope>
     </dependency>
-    <!-- Google -->
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>30.1.1-jre</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>failureaccess</artifactId>
-      <version>1.0.1</version>
-      <scope>test</scope>
-    </dependency>
     <!-- Jasypt -->
     <dependency>
       <groupId>org.apache.servicemix.bundles</groupId>
@@ -254,7 +241,7 @@
     <dependency>
       <groupId>org.jsoup</groupId>
       <artifactId>jsoup</artifactId>
-      <version>1.14.3</version>
+      <version>1.15.3</version>
       <scope>test</scope>
     </dependency>
     <!-- nullability -->
@@ -275,10 +262,16 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.bundles</groupId>
+      <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+      <scope>test</scope>
+      <version>1.3_1</version>
+    </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <version>3.12.4</version>
+      <version>4.7.0</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -287,18 +280,6 @@
       <version>1.2.0</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>com.google.truth</groupId>
-      <artifactId>truth</artifactId>
-      <version>1.1.3</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency> <!-- truth dep -->
-      <groupId>com.googlecode.java-diff-utils</groupId>
-      <artifactId>diffutils</artifactId>
-      <version>1.3.0</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam</artifactId>
@@ -332,7 +313,7 @@
     <dependency>
       <groupId>org.ops4j.pax.url</groupId>
       <artifactId>pax-url-wrap</artifactId>
-      <version>2.6.7</version>
+      <version>2.6.11</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/test/java/org/apache/sling/commons/crypto/internal/EnvironmentVariablePasswordProviderTest.java b/src/test/java/org/apache/sling/commons/crypto/internal/EnvironmentVariablePasswordProviderTest.java
index 3a1c5a1..fe808f3 100644
--- a/src/test/java/org/apache/sling/commons/crypto/internal/EnvironmentVariablePasswordProviderTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/internal/EnvironmentVariablePasswordProviderTest.java
@@ -24,7 +24,8 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
 import static com.github.stefanbirkner.systemlambda.SystemLambda.withEnvironmentVariable;
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -49,19 +50,19 @@ public class EnvironmentVariablePasswordProviderTest {
             when(configuration.name()).thenReturn("password_ascii85");
             MethodUtils.invokeMethod(provider, true, "activate", configuration);
             final char[] password = withEnvironmentVariable("password_ascii85", "+AQ?aDes!'DBMkrCi:FE6q\\sOn=Pbmn=PK8n=PK?").execute(provider::getPassword);
-            assertThat(password).isEqualTo("+AQ?aDes!'DBMkrCi:FE6q\\sOn=Pbmn=PK8n=PK?".toCharArray());
+            assertThat(password, is("+AQ?aDes!'DBMkrCi:FE6q\\sOn=Pbmn=PK8n=PK?".toCharArray()));
         }
         { // modified
             final EnvironmentVariablePasswordProviderConfiguration configuration = mock(EnvironmentVariablePasswordProviderConfiguration.class);
             when(configuration.name()).thenReturn("password_utf8");
             MethodUtils.invokeMethod(provider, true, "modified", configuration);
             final char[] password = withEnvironmentVariable("password_utf8", " Napøleøn Sølø (DK) 🏁🇩🇰").execute(provider::getPassword);
-            assertThat(password).isEqualTo(" Napøleøn Sølø (DK) 🏁🇩🇰".toCharArray());
+            assertThat(password, is(" Napøleøn Sølø (DK) 🏁🇩🇰".toCharArray()));
         }
         { // deactivate
             MethodUtils.invokeMethod(provider, true, "deactivate");
             final char[] password = withEnvironmentVariable("password_utf8", " Napøleøn Sølø (DK) 🏁🇩🇰").execute(provider::getPassword);
-            assertThat(password).isEqualTo(" Napøleøn Sølø (DK) 🏁🇩🇰".toCharArray());
+            assertThat(password, is(" Napøleøn Sølø (DK) 🏁🇩🇰".toCharArray()));
         }
     }
 
diff --git a/src/test/java/org/apache/sling/commons/crypto/internal/FilePasswordProviderTest.java b/src/test/java/org/apache/sling/commons/crypto/internal/FilePasswordProviderTest.java
index 5be5027..f082567 100644
--- a/src/test/java/org/apache/sling/commons/crypto/internal/FilePasswordProviderTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/internal/FilePasswordProviderTest.java
@@ -28,8 +28,9 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.ops4j.pax.exam.util.PathUtils;
 
-import static com.google.common.truth.Truth.assertThat;
-import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -62,18 +63,18 @@ public class FilePasswordProviderTest {
             final FilePasswordProviderConfiguration configuration = mock(FilePasswordProviderConfiguration.class);
             when(configuration.path()).thenReturn(path);
             MethodUtils.invokeMethod(provider, true, "activate", configuration);
-            assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII);
+            assertThat(provider.getPassword(), is(PASSWORD_ASCII));
         }
         { // modified
             final String path = String.format("%s/src/test/resources/password.utf8", PathUtils.getBaseDir());
             final FilePasswordProviderConfiguration configuration = mock(FilePasswordProviderConfiguration.class);
             when(configuration.path()).thenReturn(path);
             MethodUtils.invokeMethod(provider, true, "modified", configuration);
-            assertThat(provider.getPassword()).isEqualTo(PASSWORD_UTF8);
+            assertThat(provider.getPassword(), is(PASSWORD_UTF8));
         }
         { // deactivate
             MethodUtils.invokeMethod(provider, true, "deactivate");
-            assertThat(provider.getPassword()).isEqualTo(PASSWORD_UTF8);
+            assertThat(provider.getPassword(), is(PASSWORD_UTF8));
         }
     }
 
@@ -85,11 +86,11 @@ public class FilePasswordProviderTest {
         when(configuration.path()).thenReturn(path);
         when(configuration.fix_posixNewline()).thenReturn(false);
         MethodUtils.invokeMethod(provider, true, "activate", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII));
         // enable fix for POSIX newline
         when(configuration.fix_posixNewline()).thenReturn(true);
         MethodUtils.invokeMethod(provider, true, "modified", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII));
     }
 
     @Test
@@ -100,11 +101,11 @@ public class FilePasswordProviderTest {
         when(configuration.path()).thenReturn(path);
         when(configuration.fix_posixNewline()).thenReturn(false);
         MethodUtils.invokeMethod(provider, true, "activate", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII_NEWLINE);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII_NEWLINE));
         // enable fix for POSIX newline
         when(configuration.fix_posixNewline()).thenReturn(true);
         MethodUtils.invokeMethod(provider, true, "modified", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII));
     }
 
     @Test
@@ -115,11 +116,11 @@ public class FilePasswordProviderTest {
         when(configuration.path()).thenReturn(path);
         when(configuration.fix_posixNewline()).thenReturn(false);
         MethodUtils.invokeMethod(provider, true, "activate", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII_NEWLINES);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII_NEWLINES));
         // enable fix for POSIX newline
         when(configuration.fix_posixNewline()).thenReturn(true);
         MethodUtils.invokeMethod(provider, true, "modified", configuration);
-        assertThat(provider.getPassword()).isEqualTo(PASSWORD_ASCII_NEWLINE);
+        assertThat(provider.getPassword(), is(PASSWORD_ASCII_NEWLINE));
     }
 
     @Test
diff --git a/src/test/java/org/apache/sling/commons/crypto/internal/PbeSecretKeyProviderTest.java b/src/test/java/org/apache/sling/commons/crypto/internal/PbeSecretKeyProviderTest.java
index f069ed3..8315c03 100644
--- a/src/test/java/org/apache/sling/commons/crypto/internal/PbeSecretKeyProviderTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/internal/PbeSecretKeyProviderTest.java
@@ -29,8 +29,9 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static com.google.common.truth.Truth.assertThat;
-import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -91,7 +92,7 @@ public class PbeSecretKeyProviderTest {
             when(configuration.iterationCount()).thenReturn(1024);
             when(configuration.keyLength()).thenReturn(128);
             MethodUtils.invokeMethod(provider, true, "activate", configuration);
-            assertThat(provider.getSecretKey().getAlgorithm()).isEqualTo("PBKDF2WithHmacSHA1");
+            assertThat(provider.getSecretKey().getAlgorithm(), is("PBKDF2WithHmacSHA1"));
         }
         { // modified
             final PbeSecretKeyProviderConfiguration configuration = mock(PbeSecretKeyProviderConfiguration.class);
@@ -99,11 +100,11 @@ public class PbeSecretKeyProviderTest {
             when(configuration.iterationCount()).thenReturn(2048);
             when(configuration.keyLength()).thenReturn(256);
             MethodUtils.invokeMethod(provider, true, "modified", configuration);
-            assertThat(provider.getSecretKey().getAlgorithm()).isEqualTo("PBKDF2WithHmacSHA256");
+            assertThat(provider.getSecretKey().getAlgorithm(), is("PBKDF2WithHmacSHA256"));
         }
         { // deactivate
             provider.deactivate();
-            assertThat(provider.getSecretKey().getAlgorithm()).isEqualTo("PBKDF2WithHmacSHA256");
+            assertThat(provider.getSecretKey().getAlgorithm(), is("PBKDF2WithHmacSHA256"));
         }
     }
 
diff --git a/src/test/java/org/apache/sling/commons/crypto/internal/SecureRandomSaltProviderTest.java b/src/test/java/org/apache/sling/commons/crypto/internal/SecureRandomSaltProviderTest.java
index 08c5293..61b79a8 100644
--- a/src/test/java/org/apache/sling/commons/crypto/internal/SecureRandomSaltProviderTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/internal/SecureRandomSaltProviderTest.java
@@ -26,7 +26,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -51,18 +52,18 @@ public class SecureRandomSaltProviderTest {
             when(configuration.algorithm()).thenReturn("SHA1PRNG");
             when(configuration.keyLength()).thenReturn(8);
             MethodUtils.invokeMethod(provider, true, "activate", configuration);
-            assertThat(provider.getSalt()).hasLength(8);
+            assertThat(provider.getSalt().length, is(8));
         }
         { // modified
             final SecureRandomSaltProviderConfiguration configuration = mock(SecureRandomSaltProviderConfiguration.class);
             when(configuration.algorithm()).thenReturn("SHA1PRNG");
             when(configuration.keyLength()).thenReturn(16);
             MethodUtils.invokeMethod(provider, true, "modified", configuration);
-            assertThat(provider.getSalt()).hasLength(16);
+            assertThat(provider.getSalt().length, is(16));
         }
         { // deactivate
             MethodUtils.invokeMethod(provider, true, "deactivate");
-            assertThat(provider.getSalt()).hasLength(16);
+            assertThat(provider.getSalt().length, is(16));
         }
     }
 
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/CryptoTestSupport.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/CryptoTestSupport.java
index 8d5d430..cdfc3f5 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/CryptoTestSupport.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/CryptoTestSupport.java
@@ -18,46 +18,23 @@
  */
 package org.apache.sling.commons.crypto.it.tests;
 
-import java.util.Objects;
-
+import org.apache.sling.testing.paxexam.SlingOptions;
 import org.apache.sling.testing.paxexam.TestSupport;
 import org.ops4j.pax.exam.options.ModifiableCompositeOption;
-import org.ops4j.pax.exam.options.OptionalCompositeOption;
-import org.ops4j.pax.exam.options.extra.VMOption;
 
-import static org.apache.sling.testing.paxexam.SlingOptions.paxUrlWrap;
 import static org.apache.sling.testing.paxexam.SlingOptions.scr;
 import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.vmOption;
-import static org.ops4j.pax.exam.CoreOptions.when;
-import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
 
 public abstract class CryptoTestSupport extends TestSupport {
 
     public ModifiableCompositeOption baseConfiguration() {
+        SlingOptions.versionResolver.setVersion("org.apache.felix", "org.apache.felix.http.jetty", "4.0.14"); // 4.0.16 is incompatible due to change in Jetty 9.4.21
         return composite(
             super.baseConfiguration(),
             // Sling Commons Crypto
             testBundle("bundle.filename"),
-            scr(),
-            // testing
-            junitBundles(),
-            paxUrlWrap(),
-            wrappedBundle(mavenBundle().groupId("com.google.truth").artifactId("truth").versionAsInProject()),
-            mavenBundle().groupId("com.google.guava").artifactId("guava").versionAsInProject(),
-            mavenBundle().groupId("com.google.guava").artifactId("failureaccess").versionAsInProject(),
-            mavenBundle().groupId("com.googlecode.java-diff-utils").artifactId("diffutils").versionAsInProject(),
-            jacoco() // remove with Testing PaxExam 4.0
+            scr()
         );
     }
 
-    // remove with Testing PaxExam 4.0
-    protected OptionalCompositeOption jacoco() {
-        final String jacocoCommand = System.getProperty("jacoco.command");
-        final VMOption option = Objects.nonNull(jacocoCommand) && !jacocoCommand.trim().isEmpty() ? vmOption(jacocoCommand) : null;
-        return when(Objects.nonNull(option)).useOptions(option);
-    }
-
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/EncryptWebConsolePluginIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/EncryptWebConsolePluginIT.java
index ea4e13a..a68a6ec 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/EncryptWebConsolePluginIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/EncryptWebConsolePluginIT.java
@@ -44,8 +44,9 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 
-import static com.google.common.truth.Truth.assertThat;
 import static org.apache.sling.testing.paxexam.SlingOptions.webconsole;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
@@ -100,8 +101,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
         final Document document = Jsoup.connect(url)
             .header("Authorization", String.format("Basic %s", CREDENTIALS))
             .get();
-        assertThat(document.title()).isEqualTo("Apache Felix Web Console - Sling Commons Crypto Encrypt");
-        assertThat(document.getElementById("content").child(0).text()).isEqualTo("No crypto service available");
+        assertThat(document.title(), is("Apache Felix Web Console - Sling Commons Crypto Encrypt"));
+        assertThat(document.getElementById("content").child(0).text(), is("No crypto service available"));
     }
 
     @Test
@@ -114,8 +115,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
         final Document document = Jsoup.connect(url)
             .header("Authorization", String.format("Basic %s", CREDENTIALS))
             .get();
-        assertThat(document.title()).isEqualTo("Apache Felix Web Console - Sling Commons Crypto Encrypt");
-        assertThat(document.getElementById("service-id").child(0).text()).isEqualTo(label);
+        assertThat(document.title(), is("Apache Felix Web Console - Sling Commons Crypto Encrypt"));
+        assertThat(document.getElementById("service-id").child(0).text(), is(label));
     }
 
     @Test
@@ -129,8 +130,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
             .data("service-id", id)
             .data("message", message)
             .post();
-        assertThat(document.title()).isEqualTo("Apache Felix Web Console - Sling Commons Crypto Encrypt");
-        assertThat(document.getElementById("ciphertext").text()).isEqualTo(text);
+        assertThat(document.title(), is("Apache Felix Web Console - Sling Commons Crypto Encrypt"));
+        assertThat(document.getElementById("ciphertext").text(), is(text));
     }
 
     @Test
@@ -143,8 +144,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
             .method(Method.POST)
             .ignoreHttpErrors(true)
             .execute();
-        assertThat(response.statusCode()).isEqualTo(400);
-        assertThat(response.statusMessage()).isEqualTo("Parameter message is missing");
+        assertThat(response.statusCode(), is(400));
+        assertThat(response.statusMessage(), is("Parameter message is missing"));
     }
 
     @Test
@@ -156,8 +157,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
             .method(Method.POST)
             .ignoreHttpErrors(true)
             .execute();
-        assertThat(response.statusCode()).isEqualTo(400);
-        assertThat(response.statusMessage()).isEqualTo("Parameter service-id is missing");
+        assertThat(response.statusCode(), is(400));
+        assertThat(response.statusMessage(), is("Parameter service-id is missing"));
     }
 
     @Test
@@ -171,8 +172,8 @@ public class EncryptWebConsolePluginIT extends CryptoTestSupport {
             .method(Method.POST)
             .ignoreHttpErrors(true)
             .execute();
-        assertThat(response.statusCode()).isEqualTo(404);
-        assertThat(response.statusMessage()).isEqualTo("Crypto service with service id invalid not found");
+        assertThat(response.statusCode(), is(404));
+        assertThat(response.statusMessage(), is("Crypto service with service id invalid not found"));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/EnvironmentVariablePasswordProviderIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/EnvironmentVariablePasswordProviderIT.java
index 51cd86e..6a12508 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/EnvironmentVariablePasswordProviderIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/EnvironmentVariablePasswordProviderIT.java
@@ -31,7 +31,9 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
 import static com.github.stefanbirkner.systemlambda.SystemLambda.withEnvironmentVariable;
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
@@ -63,7 +65,7 @@ public class EnvironmentVariablePasswordProviderIT extends CryptoTestSupport {
 
     @Test
     public void testPasswordProvider() {
-        assertThat(passwordProvider).isNotNull();
+        assertThat(passwordProvider, notNullValue());
     }
 
     @Test
@@ -72,7 +74,7 @@ public class EnvironmentVariablePasswordProviderIT extends CryptoTestSupport {
             .execute(() ->
                 passwordProvider.getPassword()
             );
-        assertThat(password).isEqualTo(ENVIRONMENT_VARIABLE_VALUE.toCharArray());
+        assertThat(password, is(ENVIRONMENT_VARIABLE_VALUE.toCharArray()));
     }
 
     @Test(expected = RuntimeException.class)
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/FilePasswordProviderIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/FilePasswordProviderIT.java
index 8cf8f7c..5da95df 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/FilePasswordProviderIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/FilePasswordProviderIT.java
@@ -31,7 +31,9 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 import org.ops4j.pax.exam.util.PathUtils;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
@@ -57,13 +59,13 @@ public class FilePasswordProviderIT extends CryptoTestSupport {
 
     @Test
     public void testPasswordProvider() {
-        assertThat(passwordProvider).isNotNull();
+        assertThat(passwordProvider, notNullValue());
     }
 
     @Test
     public void testPassword() {
         final String password = " Napøleøn Sølø (DK) \uD83C\uDFC1\uD83C\uDDE9\uD83C\uDDF0";
-        assertThat(passwordProvider.getPassword()).isEqualTo(password.toCharArray());
+        assertThat(passwordProvider.getPassword(), is(password.toCharArray()));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/PbeSecretKeyProviderIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/PbeSecretKeyProviderIT.java
index e50ffb2..868f194 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/PbeSecretKeyProviderIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/PbeSecretKeyProviderIT.java
@@ -32,7 +32,9 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 import org.ops4j.pax.exam.util.PathUtils;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
@@ -64,14 +66,14 @@ public class PbeSecretKeyProviderIT extends CryptoTestSupport {
 
     @Test
     public void testSecretKeyProvider() {
-        assertThat(secretKeyProvider).isNotNull();
+        assertThat(secretKeyProvider, notNullValue());
     }
 
     @Test
     public void testSecretKey() {
         final SecretKey secretKey = secretKeyProvider.getSecretKey();
-        assertThat(secretKey).isNotNull();
-        assertThat(secretKey.getAlgorithm()).isEqualTo("PBKDF2WithHmacSHA256");
+        assertThat(secretKey, notNullValue());
+        assertThat(secretKey.getAlgorithm(), is("PBKDF2WithHmacSHA256"));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/SecureRandomSaltProviderIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/SecureRandomSaltProviderIT.java
index 69f41e9..b643dc6 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/SecureRandomSaltProviderIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/SecureRandomSaltProviderIT.java
@@ -30,7 +30,9 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
@@ -55,14 +57,14 @@ public class SecureRandomSaltProviderIT extends CryptoTestSupport {
 
     @Test
     public void testSaltProvider() {
-        assertThat(saltProvider).isNotNull();
+        assertThat(saltProvider, notNullValue());
     }
 
     @Test
     public void testSalt() {
         final byte[] salt = saltProvider.getSalt();
-        assertThat(salt).isNotNull();
-        assertThat(salt).hasLength(32);
+        assertThat(salt, notNullValue());
+        assertThat(salt.length, is(32));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/it/tests/jasypt/JasyptStandardPbeStringCryptoServiceIT.java b/src/test/java/org/apache/sling/commons/crypto/it/tests/jasypt/JasyptStandardPbeStringCryptoServiceIT.java
index 9d00365..0dafc4b 100644
--- a/src/test/java/org/apache/sling/commons/crypto/it/tests/jasypt/JasyptStandardPbeStringCryptoServiceIT.java
+++ b/src/test/java/org/apache/sling/commons/crypto/it/tests/jasypt/JasyptStandardPbeStringCryptoServiceIT.java
@@ -30,7 +30,9 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.PathUtils;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
@@ -63,7 +65,7 @@ public class JasyptStandardPbeStringCryptoServiceIT extends JasyptCryptoTestSupp
 
     @Test
     public void testCryptoService() {
-        assertThat(cryptoService).isNotNull();
+        assertThat(cryptoService, notNullValue());
     }
 
     @Test
@@ -71,7 +73,7 @@ public class JasyptStandardPbeStringCryptoServiceIT extends JasyptCryptoTestSupp
         final String message = "Rudy, a Message to You";
         final String encrypted = cryptoService.encrypt(message);
         final String decrypted = cryptoService.decrypt(encrypted);
-        assertThat(decrypted).isEqualTo(message);
+        assertThat(decrypted, is(message));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptStandardPbeStringCryptoServiceTest.java b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptStandardPbeStringCryptoServiceTest.java
index 4b007ef..676d01d 100644
--- a/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptStandardPbeStringCryptoServiceTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptStandardPbeStringCryptoServiceTest.java
@@ -28,7 +28,8 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.jasypt.iv.RandomIvGenerator;
 import org.junit.Test;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
 import static org.jasypt.commons.CommonUtils.STRING_OUTPUT_TYPE_BASE64;
 import static org.jasypt.commons.CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL;
 import static org.jasypt.encryption.pbe.StandardPBEByteEncryptor.DEFAULT_KEY_OBTENTION_ITERATIONS;
@@ -55,7 +56,7 @@ public class JasyptStandardPbeStringCryptoServiceTest {
             MethodUtils.invokeMethod(service, true, "activate", configuration);
             final String ciphertext = service.encrypt(MESSAGE);
             final String message = service.decrypt(ciphertext);
-            assertThat(message).isEqualTo(MESSAGE);
+            assertThat(message, is(MESSAGE));
         }
         { // modified
             final JasyptStandardPbeStringCryptoServiceConfiguration configuration = mock(JasyptStandardPbeStringCryptoServiceConfiguration.class);
@@ -66,13 +67,13 @@ public class JasyptStandardPbeStringCryptoServiceTest {
             MethodUtils.invokeMethod(service, true, "modified", configuration);
             final String ciphertext = service.encrypt(MESSAGE);
             final String message = service.decrypt(ciphertext);
-            assertThat(message).isEqualTo(MESSAGE);
+            assertThat(message, is(MESSAGE));
         }
         { // deactivate
             MethodUtils.invokeMethod(service, true, "deactivate");
             final String ciphertext = service.encrypt(MESSAGE);
             final String message = service.decrypt(ciphertext);
-            assertThat(message).isEqualTo(MESSAGE);
+            assertThat(message, is(MESSAGE));
         }
     }
 
@@ -94,7 +95,7 @@ public class JasyptStandardPbeStringCryptoServiceTest {
         MethodUtils.invokeMethod(service, true, "activate", configuration);
         final String ciphertext = service.encrypt(MESSAGE);
         final String message = service.decrypt(ciphertext);
-        assertThat(message).isEqualTo(MESSAGE);
+        assertThat(message, is(MESSAGE));
     }
 
     @Test
@@ -115,7 +116,7 @@ public class JasyptStandardPbeStringCryptoServiceTest {
         MethodUtils.invokeMethod(service, true, "activate", configuration);
         final String ciphertext = service.encrypt(MESSAGE);
         final String message = service.decrypt(ciphertext);
-        assertThat(message).isEqualTo(MESSAGE);
+        assertThat(message, is(MESSAGE));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/commons/crypto/webconsole/internal/EncryptWebConsolePluginTest.java b/src/test/java/org/apache/sling/commons/crypto/webconsole/internal/EncryptWebConsolePluginTest.java
index 42bd6a5..f6dcf29 100644
--- a/src/test/java/org/apache/sling/commons/crypto/webconsole/internal/EncryptWebConsolePluginTest.java
+++ b/src/test/java/org/apache/sling/commons/crypto/webconsole/internal/EncryptWebConsolePluginTest.java
@@ -28,7 +28,8 @@ import org.apache.commons.lang3.reflect.MethodUtils;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -48,7 +49,7 @@ public class EncryptWebConsolePluginTest {
         MethodUtils.invokeMethod(plugin, true, "activate", bundleContext);
         plugin.doGet(request, response);
         MethodUtils.invokeMethod(plugin, true, "deactivate");
-        assertThat(stringWriter.toString()).contains("<p>No crypto service available</p>");
+        assertThat(stringWriter.toString(), containsString("<p>No crypto service available</p>"));
     }
 
     @Test