Refactor.
[yaz4j-moved-to-github.git] / src / test / java / yaz4jtest / DinosaurTest.java
index efc2247..44c9876 100644 (file)
@@ -3,6 +3,7 @@ package yaz4jtest;
 import org.junit.*;
 import static org.junit.Assert.*;
 import org.yaz4j.*;
+import org.yaz4j.exception.ZoomException;
 
 /**
  * @author adam
@@ -12,14 +13,18 @@ public class DinosaurTest {
     @Test
     public void test() {
         Connection con = new Connection("z3950.loc.gov:7090/voyager", 0);
+        try {
         assertNotNull(con);
         con.setSyntax("usmarc");
-        PrefixQuery pqf = new PrefixQuery("@attr 1=7 0253333490");
-        assertNotNull(pqf);
-        ResultSet set = con.search(pqf);
+        con.connect();
+        ResultSet set = con.search("@attr 1=7 0253333490", Connection.QueryType.PrefixQuery);
         assertNotNull(set);
         Record rec = set.getRecord(0);
         assertNotNull(rec);
-        // System.out.println(rec.render());
+        } catch (ZoomException ze) {
+          fail(ze.getMessage());
+        } finally {
+          con.close();
+        }
     }
 }