Skip to content

Commit

Permalink
Bug incorrect assumption in test framework
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
garydgregory committed Oct 10, 2024
1 parent a56c184 commit fdc8ee9
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
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;

Expand Down Expand Up @@ -282,6 +284,7 @@ public void testMissingCode() {
*/
@Test
public void testSerialization() {
assumeTrue(routine instanceof Serializable);
// Serialize the check digit routine
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
Expand Down

0 comments on commit fdc8ee9

Please sign in to comment.