/** * Ensures that the provided search exception indicates that at least one * search result reference was returned. * * @param exception The search exception to examine. * * @return The number of search result references that were returned. * * @throws AssertionError If the provided search exception indicates that no * references were returned. */ public static int assertReferenceReturned(final LDAPSearchException exception) throws AssertionError { if (exception.getReferenceCount() == 0) { throw new AssertionError(ERR_TEST_SEARCH_NO_REFS_RETURNED.get( StaticUtils.getExceptionMessage(exception))); } return exception.getReferenceCount(); }
/** * Ensures that the provided search exception indicates that no search result * references were returned. * * @param exception The search exception to examine. * * @throws AssertionError If the provided search exception indicates that * one or more references were returned. */ public static void assertNoReferencesReturned( final LDAPSearchException exception) throws AssertionError { if (exception.getReferenceCount() > 0) { throw new AssertionError(ERR_TEST_SEARCH_REFS_RETURNED.get( StaticUtils.getExceptionMessage(exception), exception.getReferenceCount())); } }
throws AssertionError if (exception.getReferenceCount() != expectedReferenceCount) ERR_TEST_SEARCH_REF_COUNT_MISMATCH_ONE_EXPECTED.get( StaticUtils.getExceptionMessage(exception), exception.getReferenceCount())); expectedReferenceCount, StaticUtils.getExceptionMessage(exception), exception.getReferenceCount()));