blob: 13b3d82aed1ac99ba6c8a8de761576ab5e195aa0 [file] [log] [blame]
package pack;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import pack.OrderedRunner.Order;
@RunWith(OrderedRunner.class)
@Order({"testNasty", "ignored", "testError", "errorExpected", "errorExpectedOther",
"compareTheStuff", "testCompareNull"})
public class Failures {
@Test
public void testNasty() throws Exception {
fail("</failure>");
}
@Ignore @Test
public void ignored() throws Exception {
fail("should not happen");
}
@Test
public void testError() throws Exception {
throw new IllegalStateException("</failure>");
}
@Test(expected=IllegalStateException.class)
public void errorExpected() throws Exception {
throw new IllegalStateException("expected");
}
@Test(expected=IllegalArgumentException.class)
public void errorExpectedOther() throws Exception {
throw new IllegalStateException("xx");
}
@Test()
public void compareTheStuff() throws Exception {
assertEquals("\nHello World.\n\n", "\n\nHello my friend.");
}
@Test
public void testCompareNull() throws Exception {
assertEquals("Hello World.", null);
}
}