From: Jakub Skoczen Date: Thu, 15 Apr 2010 10:08:02 +0000 (+0200) Subject: Add ztest based test X-Git-Tag: v1.2~4 X-Git-Url: http://git.indexdata.com/?p=yaz4j-moved-to-github.git;a=commitdiff_plain;h=c30dbf5d3f296cee5ce182b9eff27c6a471770d5 Add ztest based test Ignored when ztest is not running --- diff --git a/src/test/org/yaz4j/ConnectionTest.java b/src/test/org/yaz4j/ConnectionTest.java index 826f546..f7ea9ee 100644 --- a/src/test/org/yaz4j/ConnectionTest.java +++ b/src/test/org/yaz4j/ConnectionTest.java @@ -57,4 +57,28 @@ public class ConnectionTest { con.close(); } } + + @Test + /** + * This only works with local ztest + */ + public void recordError() { + Connection con = new Connection("localhost:9999", 0); + assertNotNull(con); + try { + con.setSyntax("postscript"); + System.out.println("Open connection to localhost:9999..."); + con.connect(); + ResultSet s = con.search("100", Connection.QueryType.PrefixQuery); + assertNotNull(s); + assertEquals(s.getSize(), 100); + Record rec = s.getRecord(0); + fail("We should never get here and get ZoomeException instead"); + } catch (ZoomException ze) { + // we need more specific exceptions here + System.out.println(ze.getMessage()); + } finally { + con.close(); + } + } }