Skip to content

Apache Lucene open-source search software

improve test assumptions: assume content instead of assert; catch IOException so we also assume no UnknownHostException

Chris M. Hostetter029b92fa7273
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java b/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
index 566233ed40f..bb348aceb34 100755
--- a/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
@@ -74,7 +74,11 @@ public class ContentStreamTest extends LuceneTestCase
in = conn.getInputStream();
contentType = conn.getContentType();
content = IOUtils.toByteArray(in);
- } catch (ConnectException ex) {
+
+ assumeTrue("not enough content for test to be useful",
+ content.length > 10 );
+
+ } catch (IOException ex) {
assumeNoException("Unable to connect to " + url + " to run the test.", ex);
}finally {
if (in != null) {
@@ -82,7 +86,6 @@ public class ContentStreamTest extends LuceneTestCase
}
}
- assertTrue( content.length > 10 ); // found something...
ContentStreamBase stream = new ContentStreamBase.URLStream( url );
assertEquals( content.length, stream.getSize().intValue() );