From c30dbf5d3f296cee5ce182b9eff27c6a471770d5 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Thu, 15 Apr 2010 12:08:02 +0200 Subject: [PATCH] Add ztest based test Ignored when ztest is not running --- src/test/org/yaz4j/ConnectionTest.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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(); + } + } } -- 1.7.10.4