You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2010/07/09 03:17:25 UTC
svn commit: r962382 -
/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
Author: dblevins
Date: Fri Jul 9 01:17:25 2010
New Revision: 962382
URL: http://svn.apache.org/viewvc?rev=962382&view=rev
Log:
Couple non-passing tests that prove sorting is unstable
Modified:
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java?rev=962382&r1=962381&r2=962382&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java Fri Jul 9 01:17:25 2010
@@ -182,6 +182,41 @@ public class ReferencesTest extends Test
}
}
+ // proof that this sort is not a stable sort -- i.e. disrupts order unnecessarily
+ // this test needs to pass
+ public void _testNoReferences() {
+
+ beans = new ArrayList<Bean>();
+
+ Bean b = bean("b");
+ Bean a = bean("a");
+ Bean d = bean("d");
+ Bean c = bean("c");
+ Bean f = bean("f");
+ Bean e = bean("e");
+
+ List<Bean> actual = sort(beans, visitor);
+
+ assertEquals(expected(b, a, d, c, f, e), actual);
+ }
+
+ // items are already in the right order
+ // this should pass but doesn't
+ public void _testOrderedReferences() {
+
+ beans = new ArrayList<Bean>();
+
+ Bean b = bean("b");
+ Bean a = bean("a");
+ Bean d = bean("d","a", "b");
+ Bean c = bean("c");
+ Bean f = bean("f");
+ Bean e = bean("e", "f");
+
+ List<Bean> actual = sort(beans, visitor);
+
+ assertEquals(expected(b, a, d, c, f, e), actual);
+ }
private List<Bean> expected(Bean... beans){
return Arrays.asList(beans);