Created
August 14, 2013 16:32
-
-
Save lfryc/6232827 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.richfaces; | |
import static org.hamcrest.Matchers.empty; | |
import static org.hamcrest.Matchers.is; | |
import static org.junit.Assert.assertThat; | |
import static org.junit.Assert.assertTrue; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.junit.Test; | |
public class MyTest { | |
private List<String> myList = Arrays.asList("a", "b", "c"); | |
/** | |
* java.lang.AssertionError | |
*/ | |
@Test | |
public void noMessage() { | |
assertTrue(myList.isEmpty()); | |
} | |
/** | |
* java.lang.AssertionError: list is empty | |
*/ | |
@Test | |
public void userProvidedMessage() { | |
assertTrue("list is empty", myList.isEmpty()); | |
} | |
/** | |
* java.lang.AssertionError: | |
* Expected: is an empty collection | |
* but: <[a, b, c]> | |
*/ | |
@Test | |
public void derivedMessage() { | |
assertThat(myList, is(empty())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment