From 029b92fa727352a0b1a0cd4c8516d4670a1a4700 Mon Sep 17 00:00:00 2001 From: "Chris M. Hostetter" Date: Fri, 2 Sep 2011 00:31:29 +0000 Subject: [PATCH] improve test assumptions: assume content instead of assert; catch IOException so we also assume no UnknownHostException git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1164311 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/common/util/ContentStreamTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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() );