diff --git a/0003-fix-broken-test.patch b/0003-fix-broken-test.patch new file mode 100644 index 0000000..c2ae49e --- /dev/null +++ b/0003-fix-broken-test.patch @@ -0,0 +1,61 @@ +diff --git a/src/test/java/org/yaml/snakeyaml/error/WrappedExceptionsTest.java b/src/test/java/org/yaml/snakeyaml/error/WrappedExceptionsTest.java +index f8b72a1..7ed8328 100644 +--- a/src/test/java/org/yaml/snakeyaml/error/WrappedExceptionsTest.java ++++ b/src/test/java/org/yaml/snakeyaml/error/WrappedExceptionsTest.java +@@ -15,43 +15,32 @@ + */ + package org.yaml.snakeyaml.error; + +-import org.hamcrest.CoreMatchers; +-import org.junit.Before; +-import org.junit.Rule; + import org.junit.Test; +-import org.junit.rules.ExpectedException; + import org.yaml.snakeyaml.LoaderOptions; + import org.yaml.snakeyaml.Yaml; + ++import static org.junit.Assert.assertEquals; ++import static org.junit.Assert.fail; ++ + public class WrappedExceptionsTest { + + private static final String INVALID_YAML = "!!seq abc"; + +- @Rule +- public final ExpectedException expectedException = ExpectedException.none(); +- +- @Before +- public void configureExpectedExceptions() { +- expectedException.expectMessage("org.yaml.snakeyaml.nodes.ScalarNode"); +- expectedException.expectMessage("org.yaml.snakeyaml.nodes.SequenceNode"); +- } +- + @Test + public void testWrapped() { +- expectedException.expect(YAMLException.class); +- expectedException +- .expectCause(CoreMatchers. instanceOf(ClassCastException.class)); +- +- LoaderOptions options = new LoaderOptions(); +- options.setWrappedToRootException(true); +- Yaml yaml = new Yaml(options); +- yaml.load(INVALID_YAML); ++ try { ++ LoaderOptions options = new LoaderOptions(); ++ options.setWrappedToRootException(true); ++ Yaml yaml = new Yaml(options); ++ yaml.load(INVALID_YAML); ++ fail(); ++ } catch (YAMLException e) { ++ assertEquals(ClassCastException.class, e.getCause().getClass()); ++ } + } + +- @Test ++ @Test(expected = ClassCastException.class) + public void testUnWrapped() { +- expectedException.expect(ClassCastException.class); +- + LoaderOptions options = new LoaderOptions(); + options.setWrappedToRootException(false); + Yaml yaml = new Yaml(options); diff --git a/snakeyaml.spec b/snakeyaml.spec index a738f16..730fcc6 100644 --- a/snakeyaml.spec +++ b/snakeyaml.spec @@ -5,7 +5,7 @@ Name: snakeyaml Summary: YAML parser and emitter for Java Version: 1.25 -Release: 1%{?dist} +Release: 2%{?dist} License: ASL 2.0 URL: https://bitbucket.org/asomov/%{name} @@ -20,6 +20,9 @@ Source0: %{url}/get/%{name}-%{version}.tar.gz Patch0: 0001-Replace-bundled-base64-implementation.patch # We don't have gdata-java in Fedora any longer, use commons-codec instead Patch1: 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch +# Fix a broken test, change backported from upstream: +# https://bitbucket.org/asomov/snakeyaml/commits/345408c +Patch2: 0003-fix-broken-test.patch BuildArch: noarch @@ -61,6 +64,7 @@ This package contains %{summary}. %setup -q -n asomov-%{name}-%{vertag} %patch0 -p1 %patch1 -p1 +%patch2 -p1 %mvn_file : %{name} @@ -114,6 +118,9 @@ rm src/test/java/org/yaml/snakeyaml/helpers/FileTestHelper.java %changelog +* Tue Oct 15 2019 Fabio Valentini - 1.25-2 +- Backport fix for a broken test from upstream. + * Thu Aug 22 2019 Fabio Valentini - 1.25-1 - Update to version 1.25.