From d5f1f175fc7baf47957eaf20522c467900298aea Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Mon, 28 Jan 2002 20:25:21 +0000 Subject: [PATCH] - Fixed tests to use non-deprecated JUnit assert methods. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149662 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/queryParser/TestQueryParser.java | 21 +++++++++---------- .../apache/lucene/util/TestPriorityQueue.java | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/test/org/apache/lucene/queryParser/TestQueryParser.java b/src/test/org/apache/lucene/queryParser/TestQueryParser.java index 2f198463ee0..c33ac0f20b6 100644 --- a/src/test/org/apache/lucene/queryParser/TestQueryParser.java +++ b/src/test/org/apache/lucene/queryParser/TestQueryParser.java @@ -158,9 +158,9 @@ public class TestQueryParser extends TestCase { assertQueryEquals("term AND \"phrase phrase\"", null, "+term +\"phrase phrase\""); assertQueryEquals("\"hello there\"", null, "\"hello there\""); - assert(getQuery("a AND b", null) instanceof BooleanQuery); - assert(getQuery("hello", null) instanceof TermQuery); - assert(getQuery("\"hello there\"", null) instanceof PhraseQuery); + assertTrue(getQuery("a AND b", null) instanceof BooleanQuery); + assertTrue(getQuery("hello", null) instanceof TermQuery); + assertTrue(getQuery("\"hello there\"", null) instanceof PhraseQuery); assertQueryEquals("germ term^2.0", null, "germ term^2.0"); assertQueryEquals("term^2.0", null, "term^2.0"); @@ -205,10 +205,10 @@ public class TestQueryParser extends TestCase { assertQueryEquals("term*germ", null, "term*germ"); assertQueryEquals("term*germ^3", null, "term*germ^3.0"); - assert(getQuery("term*", null) instanceof PrefixQuery); - assert(getQuery("term*^2", null) instanceof PrefixQuery); - assert(getQuery("term~", null) instanceof FuzzyQuery); - assert(getQuery("term*germ", null) instanceof WildcardQuery); + assertTrue(getQuery("term*", null) instanceof PrefixQuery); + assertTrue(getQuery("term*^2", null) instanceof PrefixQuery); + assertTrue(getQuery("term~", null) instanceof FuzzyQuery); + assertTrue(getQuery("term*germ", null) instanceof WildcardQuery); } public void testQPA() throws Exception { @@ -221,13 +221,13 @@ public class TestQueryParser extends TestCase { assertQueryEquals("term AND NOT phrase term", qpAnalyzer, "+term -\"phrase1 phrase2\" term"); assertQueryEquals("stop", qpAnalyzer, ""); - assert(getQuery("term term term", qpAnalyzer) instanceof BooleanQuery); - assert(getQuery("term +stop", qpAnalyzer) instanceof TermQuery); + assertTrue(getQuery("term term term", qpAnalyzer) instanceof BooleanQuery); + assertTrue(getQuery("term +stop", qpAnalyzer) instanceof TermQuery); } public void testRange() throws Exception { assertQueryEquals("[ a z]", null, "[a-z]"); - assert(getQuery("[ a z]", null) instanceof RangeQuery); + assertTrue(getQuery("[ a z]", null) instanceof RangeQuery); assertQueryEquals("[ a z ]", null, "[a-z]"); assertQueryEquals("{ a z}", null, "{a-z}"); assertQueryEquals("{ a z }", null, "{a-z}"); @@ -238,4 +238,3 @@ public class TestQueryParser extends TestCase { assertQueryEquals("gack ( bar blar { a z}) ", null, "gack (bar blar {a-z})"); } } - diff --git a/src/test/org/apache/lucene/util/TestPriorityQueue.java b/src/test/org/apache/lucene/util/TestPriorityQueue.java index fa857525e91..e4bea6a6961 100644 --- a/src/test/org/apache/lucene/util/TestPriorityQueue.java +++ b/src/test/org/apache/lucene/util/TestPriorityQueue.java @@ -101,12 +101,12 @@ public class TestPriorityQueue extends TestCase { int last = Integer.MIN_VALUE; for (int i = 0; i < count; i++) { Integer next = (Integer)pq.pop(); - assert(next.intValue() >= last); + assertTrue(next.intValue() >= last); last = next.intValue(); sum2 += last; } - assert(sum == sum2); + assertEquals(sum, sum2); // end = new Date(); // System.out.print(((float)(end.getTime()-start.getTime()) / count) * 1000);