UnsupportedOperationException on a @Field List

In my test case, I have a java.util.List annotated with @Field so as to make use of it in teardown methods. It contains the POJOs that represent the test data. It’s declared like such:

@Field List expectedStates = Arrays.asList([])

I get UnsupportedOperationException on the following line:


Why is this exception throwing? newItem is ItemData

I literally get this exception: Test Cases/AddValidItems FAILED because (of) java.lang.UnsupportedOperationException

omg, I’m amazed it worked **before** I added that @Field annotation!

The problem was with the declaration/definition of expectedStates. Doing it this way would, if I were to venture a guess, would have kept it strictly as a java.util.List or a subclass that doesn’t have the interface method add() implemented. Thus the exception. Defining it as something like an ArrayList fixed the issue.