You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pe...@apache.org on 2020/11/30 01:45:37 UTC

[commons-compress] 02/03: COMPRESS-560: Use assumeTrue/assumeFalse to check if the test should be run on the current OS

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

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

commit 7d004266d31d6bbbc0560159d39c04fec02abb9a
Author: theobisproject <th...@gmail.com>
AuthorDate: Sun Nov 22 14:09:33 2020 +0100

    COMPRESS-560: Use assumeTrue/assumeFalse to check if the test should be run on the current OS
---
 .../compress/archivers/tar/SparseFilesTest.java        | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
index 49f49e1..136aef3 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
@@ -19,6 +19,8 @@
 package org.apache.commons.compress.archivers.tar;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
 
 import org.apache.commons.compress.AbstractTestCase;
 import org.apache.commons.compress.utils.IOUtils;
@@ -73,9 +75,7 @@ public class SparseFilesTest extends AbstractTestCase {
 
     @Test
     public void testExtractSparseTarsOnWindows() throws IOException {
-        if (!isOnWindows) {
-            return;
-        }
+        assumeTrue(isOnWindows);
 
         final File oldGNUSparseTar = getFile("oldgnu_sparse.tar");
         final File paxGNUSparseTar = getFile("pax_gnu_sparse.tar");
@@ -115,9 +115,7 @@ public class SparseFilesTest extends AbstractTestCase {
 
     @Test
     public void testExtractOldGNU() throws IOException, InterruptedException {
-        if (isOnWindows) {
-            return;
-        }
+        assumeFalse(isOnWindows);
 
         try {
             final File file = getFile("oldgnu_sparse.tar");
@@ -136,9 +134,7 @@ public class SparseFilesTest extends AbstractTestCase {
 
     @Test
     public void testExtractExtendedOldGNU() throws IOException, InterruptedException {
-        if (isOnWindows) {
-            return;
-        }
+        assumeFalse(isOnWindows);
 
         final File file = getFile("oldgnu_extended_sparse.tar");
         try (InputStream sparseFileInputStream = extractTarAndGetInputStream(file, "sparse6");
@@ -177,9 +173,7 @@ public class SparseFilesTest extends AbstractTestCase {
 
     @Test
     public void testExtractPaxGNU() throws IOException, InterruptedException {
-        if (isOnWindows) {
-            return;
-        }
+        assumeFalse(isOnWindows);
 
         final File file = getFile("pax_gnu_sparse.tar");
         try (TarArchiveInputStream tin = new TarArchiveInputStream(new FileInputStream(file))) {