Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: FEST-Assert 1.3
-
Fix Version/s: FEST-Assert 1.4
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Under FEST-Assertions 1.3 a new assertThat() method was added that takes an Iterable, in my custom extension I have:
public LdapEntryAssertion doesNotExist() { assertThat(entry) .describedAs(entryName + " doe not exist in LDAP") .isNull(); return this; }
In this instance, the entry variable may or may not be null. It turns out the Class of this object implements Iterable and whilst previous would fall under the assertThat(Object) method, it nows hits assertThat(Iterable).
assertThat(Iterable) eagerly calls #iterator inorder to create a collection. This should probably be null safe with something like:
public static CollectionAssert assertThat(Iterable<?> actual) { return actual != null ? assertThat(asCollection(actual.iterator())) : assertThat(actual); }