package de.tobiasroeser.lambdatest.junit;

import static org.testng.Assert.assertEquals;

import org.junit.Assert;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.testng.annotations.Test;

public class RuntimeTest {

	public static class SimpleSuccessTest extends FreeSpec {
		public SimpleSuccessTest() {
			test("should succeed", () -> {
				Assert.assertTrue(true);
			});
		}
	}

	public static class SimpleFailureTest extends FreeSpec {
		public SimpleFailureTest() {
			test("should fail", () -> {
				Assert.assertTrue(false);
			});
		}
	}

	public static class SimplePendingTest extends FreeSpec {
		public SimplePendingTest() {
			test("should be pending", () -> {
				pending();
				Assert.fail("should not be reached");
			});
		}
	}

	public static class SimplePendingWithReasonTest extends FreeSpec {
		public SimplePendingWithReasonTest() {
			test("should be pending with reason", () -> {
				pending("With Reason");
				Assert.fail("should not be reached");
			});
		}
	}

	@Test(groups = { "junit" })
	public void testSuccess() {
		final Result result = JUnitCore.runClasses(SimpleSuccessTest.class);
		assertEquals(result.getRunCount(), 1);
		assertEquals(result.getFailureCount(), 0);
		assertEquals(result.getIgnoreCount(), 0);
	}

	@Test(groups = { "junit" })
	public void testFailure() {
		final Result result = JUnitCore.runClasses(SimpleFailureTest.class);
		assertEquals(result.getRunCount(), 1);
		assertEquals(result.getFailureCount(), 1);
		assertEquals(result.getIgnoreCount(), 0);
	}

	@Test(groups = { "junit" })
	public void testPending() {
		final Result result = JUnitCore.runClasses(SimplePendingTest.class);
		assertEquals(result.getRunCount(), 1);
		assertEquals(result.getFailureCount(), 0);
		assertEquals(result.getIgnoreCount(), 0);
	}

	@Test(groups = { "junit" })
	public void testPendingWithReason() {
		final Result result = JUnitCore.runClasses(SimplePendingWithReasonTest.class);
		assertEquals(result.getRunCount(), 1);
		assertEquals(result.getFailureCount(), 0);
		assertEquals(result.getIgnoreCount(), 0);
	}

}
@@ -212,16 +212,76 @@
 .Test;%0A%0A
+import de.tobiasroeser.lambdatest.generic.DefaultReporter;%0A%0A
 public c
@@ -548,32 +548,152 @@
 FailureTest() %7B%0A
+%09%09%09// We don't want the stacktrace to fool us in the test suite%0A%09%09%09setReporter(new DefaultReporter(System.out, false));%0A
 %09%09%09test(%22should 

Make expected JUnit test failure less verbose