You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/07/05 04:12:23 UTC
cvs commit: jakarta-commons/latka/src/test/org/apache/commons/latka/junit TestJUnitTestAdapter.java
dion 2002/07/04 19:12:23
Modified: latka/src/test/org/apache/commons/latka/junit
TestJUnitTestAdapter.java
Log:
Changed for offline testing
Revision Changes Path
1.7 +15 -7 jakarta-commons/latka/src/test/org/apache/commons/latka/junit/TestJUnitTestAdapter.java
Index: TestJUnitTestAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/test/org/apache/commons/latka/junit/TestJUnitTestAdapter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestJUnitTestAdapter.java 24 Apr 2002 07:28:36 -0000 1.6
+++ TestJUnitTestAdapter.java 5 Jul 2002 02:12:23 -0000 1.7
@@ -65,6 +65,7 @@
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.net.MalformedURLException;
+import java.net.SocketException;
import java.net.URL;
import org.apache.commons.latka.Latka;
@@ -113,9 +114,16 @@
}
public void testParser() throws Throwable {
- assertEquals(
- "Should parse the xml and count the request objects", 9,
- _adapter.parse(new InputSource(_xmlFile.toURL().toString())));
+ try {
+ assertEquals("Should parse the xml and count the request objects",
+ 9,
+ _adapter.parse(new InputSource(_xmlFile.toURL().toString())));
+ } catch (SocketException se) {
+ // allow offline tests
+ if (se.getMessage().indexOf("unreachable") == -1) {
+ fail("SocketException: " + se.toString());
+ }
+ }
}
public void testCount() {
@@ -130,14 +138,14 @@
public void testCreateAdapterFromFile() {
Test myTest = JUnitTestAdapter.createTestFromFile(_xmlFile);
- assertNotNull("Should get object back", myTest);
+ assertNotNull("Should get object back from file", myTest);
assertEquals("Should get 1 TestCase for each request",
9, myTest.countTestCases());
}
public void testCreateAdapterFromFileName() {
Test myTest = JUnitTestAdapter.createTestFromFile(_xmlFileName);
- assertNotNull("Should get object back", myTest);
+ assertNotNull("Should get object back from file name", myTest);
assertEquals("Should get 1 TestCase for each request",
9, myTest.countTestCases());
}
@@ -145,6 +153,6 @@
public void testCreateNullAdapterFromURL() {
String url = "http://www.latka-example-dummy-url.com/";
Test myTest = JUnitTestAdapter.createTestFromURL(url);
- assertNull("Should get null object back", myTest);
+ assertNull("Should get null object back from bad url", myTest);
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>