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
This commit is contained in:
Chris M. Hostetter 2011-09-02 00:31:29 +00:00
parent c20cbcf2f8
commit 029b92fa72
1 changed files with 5 additions and 2 deletions

View File

@ -74,7 +74,11 @@ public class ContentStreamTest extends LuceneTestCase
in = conn.getInputStream(); in = conn.getInputStream();
contentType = conn.getContentType(); contentType = conn.getContentType();
content = IOUtils.toByteArray(in); 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); assumeNoException("Unable to connect to " + url + " to run the test.", ex);
}finally { }finally {
if (in != null) { if (in != null) {
@ -82,7 +86,6 @@ public class ContentStreamTest extends LuceneTestCase
} }
} }
assertTrue( content.length > 10 ); // found something...
ContentStreamBase stream = new ContentStreamBase.URLStream( url ); ContentStreamBase stream = new ContentStreamBase.URLStream( url );
assertEquals( content.length, stream.getSize().intValue() ); assertEquals( content.length, stream.getSize().intValue() );