Use ResultSet and Record in test.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 17 Sep 2009 12:51:53 +0000 (14:51 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 17 Sep 2009 12:51:53 +0000 (14:51 +0200)
test/ConnectionTest.java

index d1c09d1..2f143af 100644 (file)
@@ -8,7 +8,17 @@ public class ConnectionTest {
        public void testConnection() {
                org.yaz4j.Connection con = new org.yaz4j.Connection("z3950.indexdata.dk:210/gils", 0);
                assertNotNull(con);
+               con.setSyntax("sutrs");
                org.yaz4j.PrefixQuery pqf = new org.yaz4j.PrefixQuery("@attr 1=4 utah");
-               con.Search(pqf);
+               assertNotNull(pqf);
+               org.yaz4j.ResultSet s = con.Search(pqf);
+               assertNotNull(s);
+               assertEquals(s.getSize(), 9);
+               org.yaz4j.Record rec = s.getRecord(0);
+               assertNotNull(rec);
+               byte [] content = rec.getContent();
+               // first SUTRS record
+               assertEquals(content.length, 1940);
+               assertEquals(content[0], 103);
        }
 }