try {
Connection conn = new Connection(null, 0);
conn.connect();
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(null, null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(new CQLQuery(null));
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(new PrefixQuery(null));
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(null, Connection.QueryType.CQLQuery);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ResultSet s = conn.search(null, Connection.QueryType.PrefixQuery);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ScanSet s = conn.scan((String) null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ScanSet s = conn.scan((Query) null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ScanSet s = conn.scan(new PrefixQuery(null));
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
ScanSet s = conn.scan(new CQLQuery(null));
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
conn.option(null, null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.setSyntax("sutrs");
conn.connect();
String opt = conn.option(null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
- System.out.println("Caught expected NPE: " +npe.getMessage());
-
+ fail("NPE even though option name can be null");
}
}
conn.connect();
ResultSet s = conn.search(new PrefixQuery("@attr 1=4 water"));
s.sort(null, null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
conn.connect();
ResultSet s = conn.search(new PrefixQuery("@attr 1=4 water"));
s.sort("some", null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
ResultSet s = conn.search(new PrefixQuery("@attr 1=4 water"));
Record r = s.getRecord(0);
r.get(null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
Record r = s.getRecord(0);
byte[] b = r.get("unknownType");
String str = new String(b);
+ assertEquals("", str);
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
- System.out.println("Caught expected NPE: " +npe.getMessage());
-
+ fail("NPE even though record type is not null");
}
}
conn.setSyntax("sutrs");
conn.connect();
Package p = conn.getPackage(null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
- System.out.println("Caught expected NPE: " +npe.getMessage());
-
+ fail("NPE even though option name can be null");
}
}
conn.connect();
Package p = conn.getPackage("some");
p.option(null);
+ fail("NPE not raised");
} catch (ZoomException ze) {
fail(ze.getMessage());
} catch (NullPointerException npe) {
Package drop = conn.getPackage("drop");
drop.send();
} catch (ZoomException ze) {
- fail(ze.getMessage());
+ assertEquals("Bib1Exception: Error Code = 223 (EsPermissionDeniedOnEsCannotModifyOrDelete)",
+ ze.getMessage());
} catch (NullPointerException npe) {
- System.out.println("Caught expected NPE: " +npe.getMessage());
+ fail(npe.getMessage());
}
}