package org.junit.gen5.api;

import org.opentestalliance.TestAbortedException;

/**
 * @author Sam Brannen
 * @since 5.0
 */
public final class Assumptions {

	private Assumptions() {
		/* no-op */
	}

	public static void assumeTrue(boolean condition) {
		if (!condition) {
			throw new TestAbortedException("Assumption failed: condition is not true");
		}
	}

	public static void assumeFalse(boolean condition) {
		if (condition) {
			throw new TestAbortedException("Assumption failed: condition is not false");
		}
	}

	public static void assumingThat(boolean condition, Executable executable) {
		if (condition) {
			try {
				executable.execute();
			}
			catch (AssertionError | RuntimeException e) {
				// rethrow
				throw e;
			}
			catch (Throwable e) {
				// TODO Don't wrap Throwables such as OutOfMemoryError, etc.
				throw new RuntimeException("Wrapped exception thrown from Executable", e);
			}
		}
	}

}

@@ -1,8 +1,9 @@
+%0A
 package 
@@ -23,16 +23,53 @@
 5.api;%0A%0A
+import java.util.function.Supplier;%0A%0A
 import o
@@ -422,131 +422,803 @@
 sume
-False(boolean condition) %7B%0A%09%09if (condition) %7B%0A%09%09%09throw new TestAbortedException(%22Assumption failed: condition is not false%22
+True(boolean condition, String message) %7B%0A%09%09if (!condition) %7B%0A%09%09%09throw new TestAbortedException(%22Assumption failed: %22 + message);%0A%09%09%7D%0A%09%7D%0A%0A%09public static void assumeTrue(boolean condition, Supplier%3CString%3E messageSupplier) %7B%0A%09%09if (!condition) %7B%0A%09%09%09throw new TestAbortedException(messageSupplier.get());%0A%09%09%7D%0A%09%7D%0A%0A%09public static void assumeFalse(boolean condition) %7B%0A%09%09if (condition) %7B%0A%09%09%09throw new TestAbortedException(%22Assumption failed: condition is not false%22);%0A%09%09%7D%0A%09%7D%0A%0A%09public static void assumeFalse(boolean condition, String message) %7B%0A%09%09if (condition) %7B%0A%09%09%09throw new TestAbortedException(message);%0A%09%09%7D%0A%09%7D%0A%0A%09public static void assumeFalse(boolean condition, Supplier%3CString%3E messageSupplier) %7B%0A%09%09if (condition) %7B%0A%09%09%09throw new TestAbortedException(%22Assumption failed: %22 + messageSupplier.get()
 );%0A%09

Support custom messages in failed assumptions