You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2021/06/02 22:43:49 UTC

[qpid-protonj2] branch main updated: PROTON-2393 Remove JUnit dependency from module proper

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

tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git


The following commit(s) were added to refs/heads/main by this push:
     new 62ee287  PROTON-2393 Remove JUnit dependency from module proper
62ee287 is described below

commit 62ee28760af8931bb33b39c5d053a10b909a067a
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Wed Jun 2 18:43:32 2021 -0400

    PROTON-2393 Remove JUnit dependency from module proper
    
    The test driver should use plan assertion errors without using any JUnit
    dependencies other than for its own unit tests.
---
 protonj2-test-driver/pom.xml                                         | 2 ++
 .../main/java/org/apache/qpid/protonj2/test/driver/ScriptWriter.java | 5 +++--
 .../qpid/protonj2/test/driver/expectations/AbstractExpectation.java  | 5 ++---
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/protonj2-test-driver/pom.xml b/protonj2-test-driver/pom.xml
index 9b15cfd..95cf883 100644
--- a/protonj2-test-driver/pom.xml
+++ b/protonj2-test-driver/pom.xml
@@ -63,10 +63,12 @@
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/ScriptWriter.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/ScriptWriter.java
index 951e8b5..698c5a4 100644
--- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/ScriptWriter.java
+++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/ScriptWriter.java
@@ -18,7 +18,6 @@ package org.apache.qpid.protonj2.test.driver;
 
 import static org.hamcrest.CoreMatchers.isA;
 import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
@@ -419,7 +418,9 @@ public abstract class ScriptWriter {
      *      The set of mechanisms that the server should offer in the SASL Mechanisms frame
      */
     public void expectFailingSASLPlainConnect(byte saslCode, String... offeredMechanisms) {
-        assertTrue(Arrays.asList(offeredMechanisms).contains("PLAIN"));
+        if (!Arrays.asList(offeredMechanisms).contains("PLAIN")) {
+            throw new AssertionError("Expected offered mechanisms that contains the PLAIN mechanism");
+        }
 
         expectSASLHeader().respondWithSASLPHeader();
         remoteSaslMechanisms().withMechanisms(offeredMechanisms).queue();
diff --git a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AbstractExpectation.java b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AbstractExpectation.java
index 0600e72..01f5869 100644
--- a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AbstractExpectation.java
+++ b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AbstractExpectation.java
@@ -17,7 +17,6 @@
 package org.apache.qpid.protonj2.test.driver.expectations;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.qpid.protonj2.test.driver.AMQPTestDriver;
 import org.apache.qpid.protonj2.test.driver.ScriptedExpectation;
@@ -137,8 +136,8 @@ public abstract class AbstractExpectation<T extends ListDescribedType> implement
     }
 
     protected final void verifyFrameSize(int frameSize) {
-        if (this.frameSize != null) {
-            assertEquals(this.frameSize, UnsignedInteger.valueOf(frameSize), String.format(
+        if (this.frameSize != null && !this.frameSize.equals(UnsignedInteger.valueOf(frameSize))) {
+            throw new AssertionError(String.format(
                 "Expected frame size %s did not match that of the received frame: %d", this.frameSize, frameSize));
         }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org