Skip to content

Commit 61b9f82

Browse files
georgeajitgeorgeajit
georgeajit
authored and
georgeajit
committed
marklogic#1290 - Check for IllegalStateException, message test
1 parent 581e781 commit 61b9f82

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/StringQueryHostBatcherTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public void testAndWordQuery() throws Exception
239239
StringBuilder batchResults = new StringBuilder();
240240
StringBuilder forestResults = new StringBuilder();
241241
StringBuilder batchFailResults = new StringBuilder();
242+
StringBuilder batchIllegalState = new StringBuilder();
242243

243244
// Run a QueryBatcher on the new URIs.
244245
QueryBatcher queryBatcher1 = dmManager.newQueryBatcher(querydef);
@@ -276,7 +277,23 @@ public void testAndWordQuery() throws Exception
276277
else {
277278
fail("testAndWordQuery test failed");
278279
}
279-
} catch (Exception e) {
280+
281+
try {
282+
// Verify Git # 1290
283+
QueryBatcher qb = dmManager.newQueryBatcher(client.newQueryManager().newStringDefinition().withCriteria("")).withBatchSize(10);
284+
285+
qb.onQueryFailure(throwable -> {
286+
throwable.printStackTrace();
287+
batchIllegalState.append(throwable.getMessage());
288+
});
289+
dmManager.startJob(qb);
290+
qb.awaitCompletion();
291+
} catch (Exception ex) {
292+
batchIllegalState.append(ex.getMessage());
293+
System.out.println("Exceptions buffer from empty withCriteria : " + batchIllegalState.toString());
294+
assertTrue("Exception message incorrect", batchIllegalState.toString().contains("Criteria cannot be an empty string"));
295+
}
296+
} catch (Exception e) {
280297
System.out.print(e.getMessage());
281298
} finally {
282299
clearDB();

0 commit comments

Comments
 (0)