You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2022/06/26 21:20:22 UTC

[commons-crypto] branch master updated: Don't write to stdout in tests

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3fade74  Don't write to stdout in tests
3fade74 is described below

commit 3fade7460eeb10b241150cb4465db307b765c6c4
Author: Sebb <se...@apache.org>
AuthorDate: Sun Jun 26 22:20:15 2022 +0100

    Don't write to stdout in tests
---
 .../java/org/apache/commons/crypto/NativeCodeLoaderTest.java     | 8 +-------
 .../java/org/apache/commons/crypto/jna/OpenSslNativeJnaTest.java | 9 ++-------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java b/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
index c861968..ee4d84a 100644
--- a/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
+++ b/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
@@ -33,13 +33,7 @@ public class NativeCodeLoaderTest {
 
     @Test
     public void test() {
-        if (NativeCodeLoader.isNativeCodeLoaded()) {
-            // TODO display versions once available
-            System.out.println("** INFO: Native (JNI) code loaded successfully");
-        } else {
-            System.out.println("** WARN: Native (JNI) code was not loaded: "
-                + NativeCodeLoader.getLoadingError());
-        }
+        assertTrue(NativeCodeLoader.isNativeCodeLoaded(), "Native (JNI) code loaded successfully");
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/crypto/jna/OpenSslNativeJnaTest.java b/src/test/java/org/apache/commons/crypto/jna/OpenSslNativeJnaTest.java
index 8ae0949..f98e956 100644
--- a/src/test/java/org/apache/commons/crypto/jna/OpenSslNativeJnaTest.java
+++ b/src/test/java/org/apache/commons/crypto/jna/OpenSslNativeJnaTest.java
@@ -19,17 +19,12 @@
 package org.apache.commons.crypto.jna;
 
 import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class OpenSslNativeJnaTest {
 
     @Test
     public void test() {
-        if (OpenSslJna.isEnabled()) {
-            System.out.println("** INFO: JNA is using: " + OpenSslJna.OpenSSLVersion(0));
-        } else {
-            System.out.printf("** WARN: Could not enable JNA; detected lib VERSION 0x%x: %s%n", OpenSslNativeJna.VERSION,
-                    OpenSslJna.initialisationError().getMessage());
-            // OpenSslJna.initialisationError().printStackTrace();
-        }
+        assertTrue(OpenSslJna.isEnabled(), String.format("JNA loaded OK for lib version 0x%x: ", OpenSslNativeJna.VERSION));
     }
 }