Fix test suite build against Mockito 2.x

This commit is contained in:
Mat Booth 2019-02-07 15:00:38 +00:00
parent ce13b902c5
commit 8939b6feac
4 changed files with 48 additions and 9 deletions

View File

@ -1,10 +1,10 @@
From bba585e9e4fdfc67de3b53b58b8d60923e1ccd0c Mon Sep 17 00:00:00 2001 From d42b16c3334229cc400c6713f3bd11c8df2f70cc Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com> From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 12 Feb 2018 10:53:48 +0100 Date: Mon, 12 Feb 2018 10:53:48 +0100
Subject: [PATCH 1/2] Remove Brotli compressor Subject: [PATCH 1/3] Remove Brotli compressor
--- ---
.../commons/compress/compressors/CompressorStreamFactory.java | 7 +------ .../compress/compressors/CompressorStreamFactory.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-) 1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@ -33,5 +33,5 @@ index d730b9d..ab178a9 100644
if (XZ.equalsIgnoreCase(name)) { if (XZ.equalsIgnoreCase(name)) {
-- --
2.14.3 2.20.1

View File

@ -1,10 +1,10 @@
From bab91e014f73296a8ac9a3aef2aaa324a85e9b96 Mon Sep 17 00:00:00 2001 From 575df9b9a3519186ac801a10eb632e0e2b4ddbdd Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com> From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 12 Feb 2018 10:59:55 +0100 Date: Mon, 12 Feb 2018 10:59:55 +0100
Subject: [PATCH 2/2] Remove ZSTD compressor Subject: [PATCH 2/3] Remove ZSTD compressor
--- ---
.../compress/compressors/CompressorStreamFactory.java | 14 ++------------ .../compressors/CompressorStreamFactory.java | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-) 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@ -54,5 +54,5 @@ index ab178a9..3817704 100644
} catch (final IOException e) { } catch (final IOException e) {
throw new CompressorException("Could not create CompressorOutputStream", e); throw new CompressorException("Could not create CompressorOutputStream", e);
-- --
2.14.3 2.20.1

View File

@ -0,0 +1,32 @@
From 4dd332d8f82d3a5f0ac6654d2c1733e44da6ddbd Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Thu, 7 Feb 2019 14:57:25 +0000
Subject: [PATCH 3/3] Avoid use of internal Mockito API
---
.../compress/utils/FixedLengthBlockOutputStreamTest.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java
index cfda61b..e94ccee 100644
--- a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java
@@ -39,7 +39,6 @@ import java.nio.file.Path;
import java.util.concurrent.atomic.AtomicBoolean;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Test;
-import org.mockito.internal.matchers.GreaterOrEqual;
public class FixedLengthBlockOutputStreamTest {
@@ -294,7 +293,6 @@ public class FixedLengthBlockOutputStreamTest {
private static void assertContainsAtOffset(String msg, byte[] expected, int offset,
byte[] actual) {
- assertThat(actual.length, new GreaterOrEqual<>(offset + expected.length));
for (int i = 0; i < expected.length; i++) {
assertEquals(String.format("%s ([%d])", msg, i), expected[i], actual[i + offset]);
}
--
2.20.1

View File

@ -3,7 +3,7 @@
Name: apache-%{short_name} Name: apache-%{short_name}
Version: 1.18 Version: 1.18
Release: 2%{?dist} Release: 3%{?dist}
Summary: Java API for working with compressed files and archivers Summary: Java API for working with compressed files and archivers
License: ASL 2.0 License: ASL 2.0
URL: http://commons.apache.org/proper/commons-compress/ URL: http://commons.apache.org/proper/commons-compress/
@ -13,6 +13,7 @@ Source0: http://archive.apache.org/dist/commons/compress/source/%{short_n
Patch0: 0001-Remove-Brotli-compressor.patch Patch0: 0001-Remove-Brotli-compressor.patch
Patch1: 0002-Remove-ZSTD-compressor.patch Patch1: 0002-Remove-ZSTD-compressor.patch
Patch2: 0003-Avoid-use-of-internal-Mockito-API.patch
BuildRequires: maven-local BuildRequires: maven-local
BuildRequires: mvn(junit:junit) BuildRequires: mvn(junit:junit)
@ -50,6 +51,9 @@ rm -r src/{main,test}/java/org/apache/commons/compress/compressors/brotli
rm -r src/{main,test}/java/org/apache/commons/compress/compressors/zstandard rm -r src/{main,test}/java/org/apache/commons/compress/compressors/zstandard
rm src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java rm src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
# Avoid using internal Mockito APIs
%patch2 -p1
# remove osgi tests, we don't have deps for them # remove osgi tests, we don't have deps for them
%pom_remove_dep org.ops4j.pax.exam:::test %pom_remove_dep org.ops4j.pax.exam:::test
%pom_remove_dep :org.apache.felix.framework::test %pom_remove_dep :org.apache.felix.framework::test
@ -73,6 +77,9 @@ rm src/test/java/org/apache/commons/compress/OsgiITest.java
%doc LICENSE.txt NOTICE.txt %doc LICENSE.txt NOTICE.txt
%changelog %changelog
* Thu Feb 07 2019 Mat Booth <mat.booth@redhat.com> - 1.18-3
- Fix test suite build against Mockito 2.x
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-2 * Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild