/** * Ensures that the provided search exception indicates that no search result * entries were returned. * * @param exception The search exception to examine. * * @throws AssertionError If the provided search exception indicates that * one or more entries were returned. */ public static void assertNoEntriesReturned( final LDAPSearchException exception) throws AssertionError { if (exception.getEntryCount() > 0) { throw new AssertionError(ERR_TEST_SEARCH_ENTRIES_RETURNED.get( StaticUtils.getExceptionMessage(exception), exception.getEntryCount())); } }
/** * Ensures that the provided search exception indicates that at least one * search result entry was returned. * * @param exception The search exception to examine. * * @return The number of search result entries that were returned. * * @throws AssertionError If the provided search exception indicates that no * entries were returned. */ public static int assertEntryReturned(final LDAPSearchException exception) throws AssertionError { if (exception.getEntryCount() == 0) { throw new AssertionError(ERR_TEST_SEARCH_NO_ENTRIES_RETURNED.get( StaticUtils.getExceptionMessage(exception))); } return exception.getEntryCount(); }
throws AssertionError if (exception.getEntryCount() != expectedEntryCount) ERR_TEST_SEARCH_ENTRY_COUNT_MISMATCH_ONE_EXPECTED.get( StaticUtils.getExceptionMessage(exception), exception.getEntryCount())); expectedEntryCount, StaticUtils.getExceptionMessage(exception), exception.getEntryCount()));
entriesReturned += lse.getEntryCount();