0

Possible Duplicate:
Hamcrest's hasItems

I've written a test using a hamcrest matcher that looks like:

@Test
public void testGenericsIsEmpty() {
    List<String> myStrings = new LinkedList<String>();
    assertThat((Collection)myStrings,is(empty()));
}

This works when I compile in Eclipse, but not outside of Eclipse. My maven project uses the eclipse compiler, so it compiles outside of Eclipse when using maven, but if I use the standard java compiler, it doesn't compile.

I get the error message

cannot find symbol method assertThat(java.util.Collection,org.hamcrest.Matcher>)

I'm using junit 4.10 and hamcrest 1.3.RC2.

Community
  • 1
  • 1
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406

1 Answers1

-1

Have you already tried this:

assertThat(myString, is(Matchers.<String>empty()));
Stefan Birkner
  • 24,059
  • 12
  • 57
  • 72