java - are `Matchers.hasItem` and `Matchers.contains` the same? -


i saw post

about difference between:

matchers.hasitem(..)  assert.assertthat(items, matchers.hasitem(matchers.hastostring("c"))); states 

and

matchers.contains 

but still don't difference. both 1 predicate satisfaction. no?

they same, matchers.hasitem said

will stop matching item found

then matchers.contains

the examined iterable must yield 1 item

the difference first 1 checks whether there @ least 1 item (may 2 or more), second 1 checks there 1 item (only one, no more).


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -