commit junit4 for openSUSE:Factory
Hello community, here is the log from the commit of package junit4 for openSUSE:Factory checked in at 2012-08-31 09:35:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/junit4 (Old) and /work/SRC/openSUSE:Factory/.junit4.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "junit4", Maintainer is "bnc-team-java@forge.provo.novell.com" Changes: -------- --- /work/SRC/openSUSE:Factory/junit4/junit4.changes 2011-09-23 02:04:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.junit4.new/junit4.changes 2012-08-31 09:35:39.000000000 +0200 @@ -1,0 +2,5 @@ +Tue Aug 21 05:29:10 UTC 2012 - cobexer@gmail.com + +- update to version 4.10 + +------------------------------------------------------------------- Old: ---- junit-4.5.pom junit-4.5.tar.bz2 New: ---- jdk7-testfailure.patch junit-4.10.pom junit-4.10.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ junit4.spec ++++++ --- /var/tmp/diff_new_pack.ARA3fY/_old 2012-08-31 09:35:40.000000000 +0200 +++ /var/tmp/diff_new_pack.ARA3fY/_new 2012-08-31 09:35:40.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package junit4 (Version 4.5) +# spec file for package junit4 # -# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,27 +16,29 @@ # - Name: junit4 -Version: 4.5 -Release: 3 +Version: 4.10 +Release: 0 Summary: Java regression test package License: CPL-1.0 -Url: http://www.junit.org/ Group: Development/Libraries/Java -# cvs -d:pserver:anonymous@junit.cvs.sourceforge.net:/cvsroot/junit login -# cvs -z3 -d:pserver:anonymous@junit.cvs.sourceforge.net:/cvsroot/junit export -r r45 -d junit-4.5 junit -# tar cjf junit-4.5.tar.bz2 junit-4.5/ -Source0: junit-4.5.tar.bz2 -Source1: junit-4.5.pom +Url: http://www.junit.org/ +# git clone https://github.com/KentBeck/junit.git +# cd junit +# git archive --format=tar --prefix=junit-4.10/ r4.10 |xz -9 > ../junit-4.10.tar.xz +Source0: junit-4.10.tar.xz +Source1: junit-4.10.pom +# backport cb69050a45f1688ad8c6e817cc511cfa67401f63, that fixes an occasional failure in ParentRunnerTest.useChildHarvester +Patch1: jdk7-testfailure.patch Requires(post): jpackage-utils >= 1.7.4 Requires(postun): jpackage-utils >= 1.7.4 Requires: hamcrest Requires: java >= 1.5.0 BuildRequires: ant -BuildRequires: jpackage-utils >= 1.7.4 -BuildRequires: java-devel >= 1.5.0 BuildRequires: hamcrest +BuildRequires: java-devel >= 1.5.0 +BuildRequires: jpackage-utils >= 1.7.4 +BuildRequires: xz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -50,9 +52,8 @@ %package manual -License: CPL-1.0 -Group: Development/Libraries/Java Summary: Java regression test package +Group: Development/Libraries/Java %description manual JUnit is a regression testing framework written by Erich Gamma and Kent @@ -64,9 +65,8 @@ %package javadoc -License: CPL-1.0 -Group: Development/Libraries/Java Summary: Java regression test package +Group: Development/Libraries/Java %description javadoc JUnit is a regression testing framework written by Erich Gamma and Kent @@ -78,9 +78,8 @@ %package demo -License: CPL-1.0 -Group: Development/Libraries/Java Summary: Java regression test package +Group: Development/Libraries/Java Requires: %{name} = %{version}-%{release} %description demo @@ -97,6 +96,7 @@ find . -type f -name "*.jar" | xargs -t rm ln -s $(build-classpath hamcrest/core) lib/hamcrest-core-1.1.jar perl -pi -e 's/\r$//g' stylesheet.css +%patch1 -p0 %build export CLASSPATH= @@ -119,7 +119,7 @@ cp -pr junit%{version}/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # demo -install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/demo/junit # Not using %name for last part because it is +install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/demo/junit # Not using % name for last part because it is # part of package name cp -pr junit%{version}/junit/* $RPM_BUILD_ROOT%{_datadir}/%{name}/demo/junit ++++++ jdk7-testfailure.patch ++++++ diff --git src/main/java/junit/framework/TestSuite.java src/main/java/junit/framework/TestSuite.java index 336efd1..b67006a 100644 --- src/main/java/junit/framework/TestSuite.java +++ src/main/java/junit/framework/TestSuite.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Vector; +import org.junit.internal.MethodSorter; /** * <p>A <code>TestSuite</code> is a <code>Composite</code> of Tests. @@ -146,7 +147,7 @@ public class TestSuite implements Test { Class<?> superClass= theClass; List<String> names= new ArrayList<String>(); while (Test.class.isAssignableFrom(superClass)) { - for (Method each : superClass.getDeclaredMethods()) + for (Method each : MethodSorter.getDeclaredMethods(superClass)) addTestMethod(each, names, theClass); superClass= superClass.getSuperclass(); } diff --git src/main/java/org/junit/internal/MethodSorter.java src/main/java/org/junit/internal/MethodSorter.java new file mode 100644 index 0000000..844e1c6 --- /dev/null +++ src/main/java/org/junit/internal/MethodSorter.java @@ -0,0 +1,35 @@ +package org.junit.internal; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Comparator; + +public class MethodSorter { + + /** + * Gets declared methods of a class in a predictable order. + * Using the "natural" order is unwise since the Java platform does not + * specify any particular order, and in fact JDK 7 returns a more or less + * random order; well-written test code would not assume any order, but some + * does, and a predictable failure is better than a random failure on + * certain platforms. + * @param clazz a class + * @return same as {@link Class#getDeclaredMethods} but sorted + * @see <a href="http://bugs.sun.com/view_bug.do?bug_id=7023180">JDK + * (non-)bug #7023180</a> + */ + public static Method[] getDeclaredMethods(Class<?> clazz) { + Method[] methods = clazz.getDeclaredMethods(); + Arrays.sort(methods, new Comparator<Method>() { + @Override public int compare(Method m1, Method m2) { + // Alpha sort by name, and secondarily by other differentiating + // information (parameters and return type). + return m1.toString().compareTo(m2.toString()); + } + }); + return methods; + } + + private MethodSorter() {} + +} diff --git src/main/java/org/junit/internal/runners/TestClass.java src/main/java/org/junit/internal/runners/TestClass.java index 1ca2b9d..69f404f 100644 --- src/main/java/org/junit/internal/runners/TestClass.java +++ src/main/java/org/junit/internal/runners/TestClass.java @@ -11,6 +11,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.internal.MethodSorter; import org.junit.runners.BlockJUnit4ClassRunner; /** @@ -41,7 +42,7 @@ public class TestClass { public List<Method> getAnnotatedMethods(Class<? extends Annotation> annotationClass) { List<Method> results= new ArrayList<Method>(); for (Class<?> eachClass : getSuperClasses(fClass)) { - Method[] methods= eachClass.getDeclaredMethods(); + Method[] methods= MethodSorter.getDeclaredMethods(eachClass); for (Method eachMethod : methods) { Annotation annotation= eachMethod.getAnnotation(annotationClass); if (annotation != null && ! isShadowed(eachMethod, results)) diff --git src/main/java/org/junit/runners/model/TestClass.java src/main/java/org/junit/runners/model/TestClass.java index 891059a..708f9c5 100644 --- src/main/java/org/junit/runners/model/TestClass.java +++ src/main/java/org/junit/runners/model/TestClass.java @@ -12,6 +12,7 @@ import java.util.Map; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.internal.MethodSorter; /** * Wraps a class to be run, providing method validation and annotation searching @@ -36,7 +37,7 @@ public class TestClass { "Test class can only have one constructor"); for (Class<?> eachClass : getSuperClasses(fClass)) { - for (Method eachMethod : eachClass.getDeclaredMethods()) + for (Method eachMethod : MethodSorter.getDeclaredMethods(eachClass)) addToAnnotationLists(new FrameworkMethod(eachMethod), fMethodsForAnnotations); for (Field eachField : eachClass.getDeclaredFields()) -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de