Modifying a collection parameter throws
All 3 scenarios hold
A collection that a table passes to a test method is read-only. Adding to a List or a Set throws. Putting into a Map throws. Modifying any collection nested inside them throws. A row's data therefore stays as written, however the test method treats it.
The modification attempted is add for a List or Set, and put for a Map.
expected outcome
broken scenario
| Scenario | Input value | Collection type? | Modification throws? |
|---|---|---|---|
| A list |
| java.util.List | java.lang.UnsupportedOperationException |
| A set |
| java.util.Set | java.lang.UnsupportedOperationException |
| A map |
| java.util.Map | java.lang.UnsupportedOperationException |