You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/10/10 20:15:36 UTC

(commons-validator) branch master updated: Bug incorrect assumption in test framework

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

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


The following commit(s) were added to refs/heads/master by this push:
     new fdc8ee9c Bug incorrect assumption in test framework
fdc8ee9c is described below

commit fdc8ee9c26f668192b34ec5b955b3adf47f98b2d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Oct 10 16:15:31 2024 -0400

    Bug incorrect assumption in test framework
    
    AbstractCheckDigitTest.testSerialization() incoorectly assumes that the
    class it is testing implements Serializable.
    
    The class tested is a CheckDigit which does not implement Serializable.
    
    Implementions of CheckDigit MAY choose to implement Serializable in
    which case testSerialization() will test.
---
 .../commons/validator/routines/checkdigit/AbstractCheckDigitTest.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java b/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
index f21d6256..41ccf114 100644
--- a/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
@@ -21,11 +21,13 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -282,6 +284,7 @@ public abstract class AbstractCheckDigitTest {
      */
     @Test
     public void testSerialization() {
+        assumeTrue(routine instanceof Serializable);
         // Serialize the check digit routine
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {