Skip to content

Why is convenient asList() deprecated in favor of verbose asInstanceOf(InstanceOfAssertFactories.LIST)? #3424

Answered by scordio
NadChel asked this question in Q&A
Discussion options

You must be logged in to vote

It's mostly a design decision to draw a clear line for maintenance.

In short, asList is a historical method introduced before asInstanceOf/InstanceOfAssertFactories were available.

Given that asList is not type-safe (#3105) and many other related methods are not offered today (#1020), we wanted to draw the line knowing that we provide over 80 base factories plus more than 20 type-safe ones with InstanceOfAssertFactories.

About verbosity, a static import can of course help:

asInstanceOf(LIST)

However, I agree InstanceOfAssertFactory tends to be verbose so we'll look at improving the naming in version 4 (#3425).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NadChel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants