protected internal virtual void verifyQueryResults(Query query, int countExpected) { assertEquals(countExpected, query.list().size()); assertEquals(countExpected, query.count()); if (countExpected == 1) { assertNotNull(query.singleResult()); } else if (countExpected > 1) { verifySingleResultFails(query); } else if (countExpected == 0) { assertNull(query.singleResult()); } }
private void verifySingleResultFails(Query query) { try { query.singleResult(); fail("Exception expected"); } catch (ProcessEngineException) { // expected exception } }