Rewrite exception handling
[yaz4j-moved-to-github.git] / src / test / java / yaz4jtest / DinosaurTest.java
1 package yaz4jtest;
2
3 import org.junit.*;
4 import static org.junit.Assert.*;
5 import org.yaz4j.*;
6 import org.yaz4j.exception.ZoomException;
7
8 /**
9  * @author adam
10  */
11 public class DinosaurTest {
12
13     @Test
14     public void test() {
15         Connection con = new Connection("z3950.loc.gov:7090/voyager", 0);
16         try {
17         assertNotNull(con);
18         con.setSyntax("usmarc");
19         con.connect();
20         ResultSet set = con.search("@attr 1=7 0253333490", Connection.QueryType.PrefixQuery);
21         assertNotNull(set);
22         Record rec = set.getRecord(0);
23         assertNotNull(rec);
24         } catch (ZoomException ze) {
25           fail(ze.getMessage());
26         } finally {
27           con.close();
28         }
29     }
30 }