From 9558bfe674130f51a9f287708387b2970fdc83f6 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 24 Jul 2011 13:44:04 +0000 Subject: [PATCH] SOLR-2672, SOLR-2673: Fix a bunch of tests to no longer depend on order git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1150362 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/org/apache/solr/EchoParamsTest.java | 22 ++++++++++++------- .../org/apache/solr/search/TestFiltering.java | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/EchoParamsTest.java b/solr/core/src/test/org/apache/solr/EchoParamsTest.java index b09011364d4..dded78d2df4 100644 --- a/solr/core/src/test/org/apache/solr/EchoParamsTest.java +++ b/solr/core/src/test/org/apache/solr/EchoParamsTest.java @@ -31,25 +31,32 @@ public class EchoParamsTest extends SolrTestCaseJ4 { } private static final String HEADER_XPATH = "/response/lst[@name='responseHeader']"; - + @Test - public void testDefaultEchoParams() { + public void test() { + defaultEchoParams(); + defaultEchoParamsDefaultVersion(); + explicitEchoParams(); + allEchoParams(); + } + + // the following test methods rely on their order, which is no longer guaranteed by Java 7, so call them directly above: + + private void defaultEchoParams() { lrf.args.put("wt", "xml"); lrf.args.put(CommonParams.VERSION, "2.2"); assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']"); assertQ(req("foo"),"not(//lst[@name='params'])"); } - @Test - public void testDefaultEchoParamsDefaultVersion() { + private void defaultEchoParamsDefaultVersion() { lrf.args.put("wt", "xml"); lrf.args.remove(CommonParams.VERSION); assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']"); assertQ(req("foo"),"not(//lst[@name='params'])"); } - @Test - public void testExplicitEchoParams() { + private void explicitEchoParams() { lrf.args.put("wt", "xml"); lrf.args.put(CommonParams.VERSION, "2.2"); lrf.args.put("echoParams", "explicit"); @@ -58,8 +65,7 @@ public class EchoParamsTest extends SolrTestCaseJ4 { assertQ(req("foo"),HEADER_XPATH + "/lst[@name='params']/str[@name='wt'][.='xml']"); } - @Test - public void testAllEchoParams() { + private void allEchoParams() { lrf = h.getRequestFactory ("crazy_custom_qt", 0, 20, CommonParams.VERSION,"2.2", diff --git a/solr/core/src/test/org/apache/solr/search/TestFiltering.java b/solr/core/src/test/org/apache/solr/search/TestFiltering.java index f9c3b310c18..07fe549ef10 100644 --- a/solr/core/src/test/org/apache/solr/search/TestFiltering.java +++ b/solr/core/src/test/org/apache/solr/search/TestFiltering.java @@ -36,6 +36,7 @@ public class TestFiltering extends SolrTestCaseJ4 { public void testCaching() throws Exception { + clearIndex(); assertU(adoc("id","4", "val_i","1")); assertU(adoc("id","1", "val_i","2")); assertU(adoc("id","3", "val_i","3"));