/** * Verifies that the actual {@code CharSequence} has a length that's the same as the number of * elements in the given array. * * @param other the given array to be used for size comparison. * @return {@code this} assertion object. * @throws AssertionError if the actual {@code CharSequence} has a length that's different from * the number of elements in the array. * @throws NullPointerException if the given array is {@code null}. */ public S hasSameSizeAs(Object other) { strings.assertHasSameSizeAs(info, actual, other); return myself; }
/** * Verifies that the actual {@code CharSequence} has a length that's the same as the number of * elements in the given Iterable. * * @param other the given {@code Iterable} to be used for size comparison. * @return {@code this} assertion object. * @throws AssertionError if the actual {@code CharSequence} has a length that's different from * the number of elements in the {@code Iterable}. * @throws NullPointerException if the given {@code Iterable} is {@code null}. */ @Override public S hasSameSizeAs(Iterable<?> other) { strings.assertHasSameSizeAs(info, actual, other); return myself; }
/** * Verifies that the actual {@code CharSequence} has a length that's the same as the length of the * given {@code CharSequence}. * * <p>Examples : * * <pre> * // assertion will pass * assertThat("C-3PO").hasSameSizeAs("R2-D2"); * * // assertion will fail as actual and expected sizes differ * assertThat("C-3PO").hasSameSizeAs("B1 battle droid"); * </pre> * * @param other the given {@code CharSequence} to be used for size comparison. * @return {@code this} assertion object. * @throws AssertionError if the actual {@code CharSequence} has a length that's different from * the length of the given {@code CharSequence}. * @throws NullPointerException if the given {@code CharSequence} is {@code null}. */ public S hasSameSizeAs(CharSequence other) { strings.assertHasSameSizeAs(info, actual, other); return myself; }