Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

in a junit test how test if empty list is returned

You can simply use

assertFalse(result.isEmpty());
or
assertThat(items, IsCollectionWithSize.hasSize(greaterThan(1)))
Regarding your problem, it's simply caused by the fact that you forgot to statically import the is() method from Hamcrest;

import static org.hamcrest.CoreMatchers.is;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #junit #test #test #empty #list #returned
ADD COMMENT
Topic
Name
6+4 =