SOLR-2002: change tests from TestCase to LuceneTestCase for better coverage

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@983530 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-08-09 06:11:16 +00:00
parent 21263ece52
commit 61954ca249
60 changed files with 140 additions and 151 deletions

View File

@ -21,9 +21,9 @@ import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public abstract class DocumentTestCase extends TestCase
public abstract class DocumentTestCase extends LuceneTestCase
{
public DocumentTestCase(String name) {
super(name);

View File

@ -19,14 +19,14 @@ package org.apache.lucene.benchmark.byTask;
import java.io.StringReader;
import java.util.ArrayList;
import junit.framework.TestCase;
import org.apache.lucene.benchmark.byTask.tasks.PerfTask;
import org.apache.lucene.benchmark.byTask.tasks.TaskSequence;
import org.apache.lucene.benchmark.byTask.utils.Algorithm;
import org.apache.lucene.util.LuceneTestCase;
/** Test very simply that perf tasks are parses as expected. */
public class TestPerfTasksParse extends TestCase {
public class TestPerfTasksParse extends LuceneTestCase {
static final String NEW_LINE = System.getProperty("line.separator");
static final String INDENT = " ";

View File

@ -23,12 +23,11 @@ import java.io.StringReader;
import java.text.ParseException;
import java.util.Date;
import junit.framework.TestCase;
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.util.LuceneTestCase;
public class TrecContentSourceTest extends TestCase {
public class TrecContentSourceTest extends LuceneTestCase {
/** A TrecDocMaker which works on a String and not files. */
private static class StringableTrecSource extends TrecContentSource {

View File

@ -15,7 +15,6 @@
*/
package org.apache.lucene.store.instantiated;
import junit.framework.TestCase;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.Scorer;
@ -23,6 +22,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.util.LuceneTestCase;
/**
* Assert that the content of an index
@ -30,7 +30,7 @@ import org.apache.lucene.index.IndexReader;
* for all open searchers
* also after a commit.
*/
public class TestRealTime extends TestCase {
public class TestRealTime extends LuceneTestCase {
public void test() throws Exception {

View File

@ -18,15 +18,14 @@
package org.apache.lucene.misc;
import junit.framework.TestCase;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.util.LuceneTestCase;
/**
* Test of the SweetSpotSimilarity
*/
public class SweetSpotSimilarityTest extends TestCase {
public class SweetSpotSimilarityTest extends LuceneTestCase {
public void testSweetSpotLengthNorm() {

View File

@ -18,10 +18,9 @@ package org.apache.lucene.search;
*/
import org.apache.lucene.index.Term;
import org.apache.lucene.util.LuceneTestCase;
import junit.framework.TestCase;
public class BoostingQueryTest extends TestCase {
public class BoostingQueryTest extends LuceneTestCase {
public void testBoostingQueryEquals() {
TermQuery q1 = new TermQuery(new Term("subject:", "java"));
TermQuery q2 = new TermQuery(new Term("subject:", "java"));

View File

@ -17,12 +17,12 @@ package org.apache.lucene.search.regex;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
/**
* Testcase for {@link JakartaRegexpCapabilities}
*/
public class TestJakartaRegexpCapabilities extends TestCase {
public class TestJakartaRegexpCapabilities extends LuceneTestCase {
public void testGetPrefix(){
JakartaRegexpCapabilities cap = new JakartaRegexpCapabilities();

View File

@ -17,10 +17,6 @@ package org.apache.lucene.queryParser.spans;
* limitations under the License.
*/
import javax.management.Query;
import junit.framework.TestCase;
import org.apache.lucene.queryParser.core.QueryNodeException;
import org.apache.lucene.queryParser.core.nodes.OrQueryNode;
import org.apache.lucene.queryParser.core.nodes.QueryNode;
@ -31,6 +27,8 @@ import org.apache.lucene.queryParser.standard.processors.WildcardQueryNodeProces
import org.apache.lucene.search.spans.SpanOrQuery;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.LuceneTestCase;
/**
* This test case demonstrates how the new query parser can be used.<br/>
@ -93,7 +91,7 @@ import org.apache.lucene.search.spans.SpanTermQuery;
* @see UniqueFieldQueryNodeProcessor
* @see UniqueFieldAttribute
*/
public class TestSpanQueryParser extends TestCase {
public class TestSpanQueryParser extends LuceneTestCase {
private QueryNodeProcessorPipeline spanProcessorPipeline;

View File

@ -17,11 +17,12 @@ package org.apache.lucene.queryParser.surround.query;
* limitations under the License.
*/
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
public class Test01Exceptions extends TestCase {
import org.apache.lucene.util.LuceneTestCase;
public class Test01Exceptions extends LuceneTestCase {
/** Main for running test case by itself. */
public static void main(String args[]) {
TestRunner.run(new TestSuite(Test01Exceptions.class));

View File

@ -17,12 +17,12 @@ package org.apache.lucene.queryParser.surround.query;
* limitations under the License.
*/
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.lucene.util.LuceneTestCase;
public class Test02Boolean extends TestCase {
public class Test02Boolean extends LuceneTestCase {
public static void main(String args[]) {
TestRunner.run(new TestSuite(Test02Boolean.class));
}

View File

@ -17,11 +17,12 @@ package org.apache.lucene.queryParser.surround.query;
* limitations under the License.
*/
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
public class Test03Distance extends TestCase {
import org.apache.lucene.util.LuceneTestCase;
public class Test03Distance extends LuceneTestCase {
public static void main(String args[]) {
TestRunner.run(new TestSuite(Test03Distance.class));
}

View File

@ -1,8 +1,7 @@
package org.apache.lucene.spatial;
import junit.framework.TestCase;
import org.apache.lucene.spatial.tier.InvalidGeoException;
import org.apache.lucene.util.LuceneTestCase;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -26,7 +25,7 @@ import org.apache.lucene.spatial.tier.InvalidGeoException;
*
*
**/
public class DistanceUtilsTest extends TestCase {
public class DistanceUtilsTest extends LuceneTestCase {
public void testBoxCorner() throws Exception {
double[] zero = new double[]{0, 0};

View File

@ -21,13 +21,14 @@ import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectOutputStream;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
/**
*
* Test for {@link CartesianShapeFilter}
*
*/
public class TestCartesianShapeFilter extends TestCase {
public class TestCartesianShapeFilter extends LuceneTestCase {
public void testSerializable() throws IOException {
CartesianShapeFilter filter = new CartesianShapeFilter(new Shape("1"),

View File

@ -17,9 +17,9 @@ package org.apache.lucene.search.spell;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestJaroWinklerDistance extends TestCase {
public class TestJaroWinklerDistance extends LuceneTestCase {
private StringDistance sd = new JaroWinklerDistance();

View File

@ -17,9 +17,9 @@ package org.apache.lucene.search.spell;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestLevenshteinDistance extends TestCase {
public class TestLevenshteinDistance extends LuceneTestCase {
private StringDistance sd = new LevensteinDistance();

View File

@ -17,9 +17,9 @@ package org.apache.lucene.search.spell;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestNGramDistance extends TestCase {
public class TestNGramDistance extends LuceneTestCase {

View File

@ -20,15 +20,14 @@ package org.apache.lucene.search.spell;
import java.io.IOException;
import java.io.StringReader;
import junit.framework.TestCase;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
/**
* Test case for PlainTextDictionary
*
*/
public class TestPlainTextDictionary extends TestCase {
public class TestPlainTextDictionary extends LuceneTestCase {
public void testBuild() throws IOException {
final String LF = System.getProperty("line.separator");

View File

@ -21,17 +21,18 @@ import java.util.List;
import javax.swing.ListModel;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
/**
**/
public class TestBasicList extends TestCase {
public class TestBasicList extends LuceneTestCase {
private ListModel baseListModel;
private ListSearcher listSearcher;
private List<RestaurantInfo> list;
@Override
protected void setUp() throws Exception {
super.setUp();
list = new ArrayList<RestaurantInfo>();
list.add(DataStore.canolis);
list.add(DataStore.chris);
@ -40,7 +41,6 @@ public class TestBasicList extends TestCase {
listSearcher = new ListSearcher(baseListModel);
}
public void testRows(){
assertEquals(list.size(), listSearcher.getSize());
}

View File

@ -21,16 +21,17 @@ import java.util.List;
import javax.swing.table.TableModel;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestBasicTable extends TestCase {
public class TestBasicTable extends LuceneTestCase {
private TableModel baseTableModel;
private TableSearcher tableSearcher;
private List<RestaurantInfo> list;
@Override
protected void setUp() throws Exception {
super.setUp();
list = new ArrayList<RestaurantInfo>();
list.add(DataStore.canolis);
list.add(DataStore.chris);

View File

@ -18,16 +18,17 @@ package org.apache.lucene.swing.models;
import javax.swing.ListModel;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestSearchingList extends TestCase {
public class TestSearchingList extends LuceneTestCase {
private ListModel baseListModel;
private ListSearcher listSearcher;
@Override
protected void setUp() throws Exception {
super.setUp();
baseListModel = new BaseListModel(DataStore.getRestaurants());
listSearcher = new ListSearcher(baseListModel);
}

View File

@ -16,17 +16,17 @@ package org.apache.lucene.swing.models;
* limitations under the License.
*/
import junit.framework.TestCase;
import javax.swing.table.TableModel;
import org.apache.lucene.util.LuceneTestCase;
public class TestSearchingTable extends TestCase {
public class TestSearchingTable extends LuceneTestCase {
private TableModel baseTableModel;
private TableSearcher tableSearcher;
@Override
protected void setUp() throws Exception {
super.setUp();
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
tableSearcher = new TableSearcher(baseTableModel);
}

View File

@ -16,10 +16,10 @@ package org.apache.lucene.swing.models;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestUpdatingList extends TestCase {
public class TestUpdatingList extends LuceneTestCase {
private BaseListModel baseListModel;
private ListSearcher listSearcher;
@ -27,6 +27,7 @@ public class TestUpdatingList extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
baseListModel = new BaseListModel(DataStore.getRestaurants());
listSearcher = new ListSearcher(baseListModel);

View File

@ -16,10 +16,10 @@ package org.apache.lucene.swing.models;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestUpdatingTable extends TestCase {
public class TestUpdatingTable extends LuceneTestCase {
private BaseTableModel baseTableModel;
private TableSearcher tableSearcher;
@ -27,6 +27,7 @@ public class TestUpdatingTable extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
baseTableModel = new BaseTableModel(DataStore.getRestaurants());
tableSearcher = new TableSearcher(baseTableModel);

View File

@ -334,8 +334,8 @@ public abstract class LuceneTestCase extends TestCase {
System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec);
if (TEST_LOCALE.equals("random"))
System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale);
if (TEST_TIMEZONE.equals("random"))
System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + timeZone.getID());
if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp
System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID()));
if (seed != null) {
System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);
}

View File

@ -582,8 +582,8 @@ public class LuceneTestCaseJ4 {
System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec);
if (TEST_LOCALE.equals("random"))
System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale);
if (TEST_TIMEZONE.equals("random"))
System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + timeZone.getID());
if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp
System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID()));
if (seed != null) {
System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);
}

View File

@ -17,9 +17,9 @@ package org.apache.lucene.util;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestRamUsageEstimator extends TestCase {
public class TestRamUsageEstimator extends LuceneTestCase {
public void testBasic() {
RamUsageEstimator rue = new RamUsageEstimator();

View File

@ -30,20 +30,23 @@ import java.util.Set;
import org.apache.lucene.analysis.CharReader;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class HTMLStripCharFilterTest extends TestCase {
public class HTMLStripCharFilterTest extends LuceneTestCase {
public HTMLStripCharFilterTest(String s) {
super(s);
}
protected void setUp() {
@Override
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() {
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
//this is some text here is a link and another link . This is an entity: & plus a <. Here is an &
//

View File

@ -16,7 +16,7 @@
*/
package org.apache.solr;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.core.SolrInfoMBean;
import org.apache.solr.handler.StandardRequestHandler;
import org.apache.solr.handler.admin.LukeRequestHandler;
@ -34,7 +34,7 @@ import java.util.List;
/**
* A simple test used to increase code coverage for some standard things...
*/
public class SolrInfoMBeanTest extends TestCase
public class SolrInfoMBeanTest extends LuceneTestCase
{
/**
* Gets a list of everything we can find in the classpath and makes sure it has

View File

@ -17,9 +17,9 @@
package org.apache.solr.analysis;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class TestMappingCharFilterFactory extends TestCase {
public class TestMappingCharFilterFactory extends LuceneTestCase {
public void testParseString() throws Exception {
MappingCharFilterFactory f = new MappingCharFilterFactory();

View File

@ -22,12 +22,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.synonym.SynonymMap;
import org.apache.lucene.util.LuceneTestCase;
public class TestSynonymMap extends TestCase {
public class TestSynonymMap extends LuceneTestCase {
public void testInvalidMappingRules() throws Exception {
SynonymMap synMap = new SynonymMap( true );

View File

@ -19,7 +19,7 @@ package org.apache.solr.client.solrj;
import java.net.UnknownHostException;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@ -32,7 +32,7 @@ import org.apache.solr.common.SolrException;
* @version $Id$
* @since solr 1.3
*/
public class SolrExceptionTest extends TestCase {
public class SolrExceptionTest extends LuceneTestCase {
public void testSolrException() throws Throwable {
// test a connection to a solr server that probably doesn't exist

View File

@ -17,17 +17,17 @@
package org.apache.solr.client.solrj;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.params.FacetParams;
import junit.framework.Assert;
import junit.framework.TestCase;
/**
*
* @version $Id$
* @since solr 1.3
*/
public class SolrQueryTest extends TestCase {
public class SolrQueryTest extends LuceneTestCase {
public void testSolrQueryMethods() {
SolrQuery q = new SolrQuery("dog");

View File

@ -17,10 +17,10 @@
package org.apache.solr.client.solrj;
import junit.framework.TestCase;
import junit.framework.Assert;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
@ -43,7 +43,7 @@ import java.util.Set;
* @version $Id$
* @since solr 1.4
*/
public class TestLBHttpSolrServer extends TestCase {
public class TestLBHttpSolrServer extends LuceneTestCase {
SolrInstance[] solr = new SolrInstance[3];
HttpClient httpClient = new HttpClient();
@ -223,7 +223,7 @@ public class TestLBHttpSolrServer extends TestCase {
jetty.start();
int newPort = jetty.getLocalPort();
if (port != 0 && newPort != port) {
TestCase.fail("TESTING FAILURE: could not grab requested port.");
fail("TESTING FAILURE: could not grab requested port.");
}
this.port = newPort;
// System.out.println("waiting.........");

View File

@ -16,7 +16,7 @@
*/
package org.apache.solr.client.solrj.beans;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.client.solrj.response.QueryResponse;
@ -36,7 +36,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TestDocumentObjectBinder extends TestCase
public class TestDocumentObjectBinder extends LuceneTestCase
{
public void testSimple() throws Exception {
DocumentObjectBinder binder = new DocumentObjectBinder();

View File

@ -21,7 +21,7 @@ import java.io.File;
import java.net.URL;
import java.util.Random;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.commons.io.IOUtils;
import org.apache.solr.SolrTestCaseJ4;
@ -35,7 +35,7 @@ import org.mortbay.jetty.webapp.WebAppContext;
* @version $Id$
* @since solr 1.3
*/
public class JettyWebappTest extends TestCase
public class JettyWebappTest extends LuceneTestCase
{
int port = 0;
static final String context = "/test";

View File

@ -17,14 +17,14 @@
package org.apache.solr.client.solrj.util;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
/**
*
* @version $Id$
* @since solr 1.3
*/
public class ClientUtilsTest extends TestCase {
public class ClientUtilsTest extends LuceneTestCase {
public void testEscapeQuery()
{

View File

@ -24,14 +24,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
import junit.framework.TestCase;
/**
*/
public class SolrDocumentTest extends TestCase
public class SolrDocumentTest extends LuceneTestCase
{
public void testSimple()
{

View File

@ -10,7 +10,7 @@
*/
package org.apache.solr.common.params;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
/**
* Unit Test Case for {@link org.apache.solr.common.params.ModifiableSolrParams
@ -18,7 +18,7 @@ import junit.framework.TestCase;
*
* @author kkumar
*/
public class ModifiableSolrParamsTest extends TestCase
public class ModifiableSolrParamsTest extends LuceneTestCase
{
@Override

View File

@ -17,11 +17,10 @@
package org.apache.solr.common.params;
import junit.framework.TestCase;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.DefaultSolrParams;
import org.apache.solr.common.params.MapSolrParams;
@ -29,7 +28,7 @@ import org.apache.solr.common.params.SolrParams;
/**
*/
public class SolrParamTest extends TestCase
public class SolrParamTest extends LuceneTestCase
{
public void testGetParams() {
Map<String,String> pmap = new HashMap<String, String>();

View File

@ -27,13 +27,12 @@ import java.io.StringReader;
import java.net.URL;
import org.apache.commons.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.ContentStreamBase;
import junit.framework.TestCase;
/**
*/
public class ContentStreamTest extends TestCase
public class ContentStreamTest extends LuceneTestCase
{
public void testStringStream() throws IOException
{

View File

@ -28,14 +28,16 @@ import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class DOMUtilTest extends TestCase {
public class DOMUtilTest extends LuceneTestCase {
private DocumentBuilder builder;
private static final XPathFactory xpathFactory = XPathFactory.newInstance();
@Override
public void setUp() throws Exception {
super.setUp();
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
}

View File

@ -20,9 +20,9 @@ package org.apache.solr.common.util;
import java.io.File;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class FileUtilsTest extends TestCase {
public class FileUtilsTest extends LuceneTestCase {
public void testResolve() throws IOException {
String cwd = new File(".").getAbsolutePath();

View File

@ -21,11 +21,10 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.IteratorChain;
import junit.framework.TestCase;
public class IteratorChainTest extends TestCase {
public class IteratorChainTest extends LuceneTestCase {
private Iterator<String> makeIterator(String marker,int howMany) {
final List<String> c = new ArrayList<String>();

View File

@ -17,9 +17,9 @@
package org.apache.solr.common.util;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
public class NamedListTest extends TestCase {
public class NamedListTest extends LuceneTestCase {
public void testRemove() {
NamedList<String> nl = new NamedList<String>();
nl.add("key1", "value1");

View File

@ -17,14 +17,14 @@ package org.apache.solr.common.util;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import java.util.Random;
/** Tests for lookup3ycs hash functions
* @author yonik
*/
public class TestHash extends TestCase {
public class TestHash extends LuceneTestCase {
// Test that the java version produces the same output as the C version
public void testEqualsLOOKUP3() {

View File

@ -16,6 +16,7 @@
*/
package org.apache.solr.common.util;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.TestDistributedSearch;
@ -28,9 +29,7 @@ import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import junit.framework.TestCase;
public class TestNamedListCodec extends TestCase {
public class TestNamedListCodec extends LuceneTestCase {
public void testSimple() throws Exception{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
NamedList nl = new NamedList();
@ -252,7 +251,7 @@ public class TestNamedListCodec extends TestCase {
if (cmp != null) {
System.out.println(nl);
System.out.println(res);
TestCase.fail(cmp);
fail(cmp);
}
}
}

View File

@ -17,17 +17,16 @@
package org.apache.solr.common.util;
import junit.framework.TestCase;
import java.io.IOException;
import java.io.StringWriter;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.XML;
/** Test (some of the) character escaping functions of the XML class
* $Id$
*/
public class TestXMLEscaping extends TestCase {
public class TestXMLEscaping extends LuceneTestCase {
private void doSimpleTest(String input,String expectedOutput) throws IOException {
final StringWriter sw = new StringWriter();
XML.escapeCharData(input, sw);

View File

@ -17,9 +17,9 @@
package org.apache.solr.core;
import junit.framework.TestCase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.LuceneTestCase;
import org.easymock.EasyMock;
import java.io.IOException;
@ -28,7 +28,7 @@ import java.io.File;
/**
* Test-case for RAMDirectoryFactory
*/
public class RAMDirectoryFactoryTest extends TestCase {
public class RAMDirectoryFactoryTest extends LuceneTestCase {
public void testOpenReturnsTheSameForSamePath() throws IOException {
final Directory directory = new RefCntRamDirectory();
RAMDirectoryFactory factory = new RAMDirectoryFactory() {

View File

@ -18,8 +18,8 @@
package org.apache.solr.core;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.analysis.KeywordTokenizerFactory;
import org.apache.solr.analysis.NGramFilterFactory;
import org.apache.solr.common.SolrException;
@ -35,7 +35,7 @@ import java.nio.charset.CharacterCodingException;
import java.util.Arrays;
import java.util.List;
public class ResourceLoaderTest extends TestCase
public class ResourceLoaderTest extends LuceneTestCase
{
public void testInstanceDir() throws Exception {
SolrResourceLoader loader = new SolrResourceLoader(null);

View File

@ -21,9 +21,8 @@ import java.io.*;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.apache.noggit.JSONParser;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
import org.apache.solr.update.AddUpdateCommand;
@ -32,7 +31,7 @@ import org.apache.solr.update.DeleteUpdateCommand;
import org.apache.solr.update.RollbackUpdateCommand;
import org.apache.solr.update.processor.UpdateRequestProcessor;
public class JsonLoaderTest extends TestCase {
public class JsonLoaderTest extends LuceneTestCase {
static String input = ("{\n" +
"\n" +

View File

@ -20,12 +20,11 @@ package org.apache.solr.handler.admin;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.SimpleOrderedMap;
public class SystemInfoHandlerTest extends TestCase {
public class SystemInfoHandlerTest extends LuceneTestCase {
public void testMagickGetter() {

View File

@ -20,15 +20,14 @@ package org.apache.solr.schema;
import org.apache.solr.schema.DateField;
import org.apache.solr.util.DateMathParser;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.util.LocalizedTestCase;
import java.util.Date;
import java.util.TimeZone;
import java.util.Locale;
import java.text.DateFormat;
import junit.framework.TestCase;
public class LegacyDateFieldTest extends TestCase {
public class LegacyDateFieldTest extends LocalizedTestCase {
// if and when this class is removed, make sure to refactor all
// appropriate code to DateFieldTest

View File

@ -16,11 +16,10 @@
*/
package org.apache.solr.schema;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrException;
public class UUIDFieldTest extends TestCase {
public class UUIDFieldTest extends LuceneTestCase {
public void testToInternal() {
boolean ok = false;
UUIDField uuidfield = new UUIDField();

View File

@ -17,12 +17,11 @@
package org.apache.solr.search;
import junit.framework.TestCase;
import java.util.Random;
import java.util.Arrays;
import java.io.IOException;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.OpenBitSet;
import org.apache.lucene.util.OpenBitSetIterator;
import org.apache.lucene.index.IndexReader;
@ -35,7 +34,7 @@ import org.apache.lucene.search.DocIdSetIterator;
/**
* @version $Id$
*/
public class TestDocSet extends TestCase {
public class TestDocSet extends LuceneTestCase {
Random rand = new Random();
float loadfactor;

View File

@ -16,7 +16,7 @@
*/
package org.apache.solr.search;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.ConcurrentLRUCache;
@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* @see org.apache.solr.search.FastLRUCache
* @since solr 1.4
*/
public class TestFastLRUCache extends TestCase {
public class TestFastLRUCache extends LuceneTestCase {
public void testPercentageAutowarm() throws IOException {
FastLRUCache<Object, Object> fastCache = new FastLRUCache<Object, Object>();

View File

@ -5,14 +5,13 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.NamedList;
/**
* Test for <code>org.apache.solr.search.LRUCache</code>
*/
public class TestLRUCache extends TestCase {
public class TestLRUCache extends LuceneTestCase {
public void testFullAutowarm() throws IOException {
LRUCache<Object, Object> lruCache = new LRUCache<Object, Object>();

View File

@ -17,9 +17,9 @@
package org.apache.solr.util;
import org.apache.lucene.util.LocalizedTestCase;
import org.apache.solr.util.DateMathParser;
import junit.framework.TestCase;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.util.Calendar;
@ -34,7 +34,7 @@ import java.text.ParseException;
/**
* Tests that the functions in DateMathParser
*/
public class DateMathParserTest extends TestCase {
public class DateMathParserTest extends LocalizedTestCase {
public static TimeZone UTC = TimeZone.getTimeZone("UTC");

View File

@ -17,6 +17,7 @@
package org.apache.solr.util;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.util.NumberUtils;
import org.apache.solr.util.BCDUtils;
import org.junit.Assert;
@ -25,9 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import junit.framework.TestCase;
public class TestNumberUtils extends TestCase {
public class TestNumberUtils extends LuceneTestCase {
private static String arrstr(char[] arr, int start, int end) {
String str="[";

View File

@ -17,11 +17,10 @@
package org.apache.solr.util;
import junit.framework.TestCase;
import java.util.Random;
import java.util.BitSet;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.OpenBitSetIterator;
import org.apache.lucene.search.DocIdSetIterator;
@ -29,7 +28,7 @@ import org.apache.lucene.search.DocIdSetIterator;
* @deprecated
* @version $Id$
*/
public class TestOpenBitSet extends TestCase {
public class TestOpenBitSet extends LuceneTestCase {
static Random rand = new Random();
void doGet(BitSet a, OpenBitSet b) {

View File

@ -17,13 +17,12 @@
package org.apache.solr.util;
import junit.framework.TestCase;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.StrUtils;
import org.junit.Assert;
@ -31,7 +30,7 @@ import org.junit.Assert;
/**
* @version $Id$
*/
public class TestUtils extends TestCase {
public class TestUtils extends LuceneTestCase {
public static void testSplitEscaping() {
List<String> arr = StrUtils.splitSmart("\\r\\n:\\t\\f\\b", ":", true);
assertEquals(2,arr.size());