Helper method that handles building the assertion failure exceptions.
They are returned from this method so that the stack trace still shows
the assertions method.
342032
static protected function createException($value, $message, $code, $propertyPath, array $constraints = array())
        {
            $constraintString = 'Constraints: ';

            if (count($constraints)) {
                foreach ($constraints as $key => $v) {
                    $constraintString .= "$key => $v, ";
                }

                $constraintString = substr($$constraintString, 0, -2);
            }

            return new Exception("$message => $code => $value => $propertyPath => $constraintString");
        }
1323665
def assert_called_with(_mock_self, *args, **kwargs):
        """"""
        self = _mock_self
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            raise AssertionError('Expected call: {}\nNot called'.format(expected))

        def _error_message(cause):
            msg = self._format_mock_failure_message(args, kwargs)
            if six.PY2 and cause is not None:
                # Tack on some diagnostics for Python without __cause__
                msg = '{}\n{}'.format(msg, str(cause))
            return msg
        expected = self._call_matcher((args, kwargs))
        actual = self._call_matcher(self.call_args)
        if expected != actual:
            cause = expected if isinstance(expected, Exception) else None
            six.raise_from(AssertionError(_error_message(cause)), cause)
686419
@Then("^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?")
    public void assertExceptionNotThrown(String exception, String foo, String clazz, String bar, String exceptionMsg)
            throws ClassNotFoundException {
        List<Exception> exceptions = commonspec.getExceptions();
        if ("IS NOT".equals(exception)) {
            assertThat(exceptions).as("Captured exception list is not empty").isEmpty();
        } else {
            assertThat(exceptions).as("Captured exception list is empty").isNotEmpty();
            Exception ex = exceptions.get(exceptions.size() - 1);
            if ((clazz != null) && (exceptionMsg != null)) {
                assertThat(ex.toString()).as("Unexpected last exception class").contains(clazz);
                assertThat(ex.toString()).as("Unexpected last exception message").contains(exceptionMsg);

            } else if (clazz != null) {
                assertThat(exceptions.get(exceptions.size() - 1).getClass().getSimpleName()).as("Unexpected last exception class").isEqualTo(clazz);
            }

            commonspec.getExceptions().clear();
        }
    }
380757
def on_assert(self, node):    # ('test', 'msg')
        """"""
        if not self.run(node.test):
            self.raise_exception(node, exc=AssertionError, msg=node.msg)
        return True
1191798
function assert(expr) {
  if (expr) return;

  var stack = callsite();
  var call = stack[1];
  var file = call.getFileName();
  var lineno = call.getLineNumber();
  var src = fs.readFileSync(file, 'utf8');
  var line = src.split('\n')[lineno-1];
  var src = line.match(/assert\((.*)\)/)[1];

  var err = new AssertionError({
    message: src,
    stackStartFunction: stack[0].getFunction()
  });

  throw err;
}
634166
private AssertionError createComparisonFailure(String className, String expected, String actual) throws Exception {
		Class<?> clazz = Class.forName(className);
		Constructor<?> constructor = clazz.getConstructor(String.class, String.class, String.class);
		return (AssertionError) constructor.newInstance("", expected, actual);
	}
115137
public static void assertTrue(String message, boolean value) {
        if (value) {
            pass(message);
        } else {
            fail(message, null);
        }
    }
951287
private Status executeFail(Stmt.Fail stmt, CallStack frame, EnclosingScope scope) {
		throw new AssertionError("Runtime fault occurred");
	}
81248
public void assertAuthFail(byte[] expectedSignature, BuilderMode builderMode, String errorMessage) {
        if (isHashEquals(expectedSignature, builderMode)) {
            if (Validator.isEmpty(errorMessage)) {
                throw new IllegalArgumentException();
            } else {
                throw new IllegalArgumentException(errorMessage);
            }
        }
    }
840557
public void methodErrorHook(String hookedClassQualifiedName,
            String hookedMethodSimpleName, Throwable e) {
        if (currentRunResult == null) {
            return; // maybe called outside of the root method
        }
        TestMethod rootMethod = currentRunResult.getRootMethod();
        if (!rootMethod.getTestClassKey().equals(hookedClassQualifiedName)
                || !rootMethod.getSimpleName().equals(hookedMethodSimpleName)) {
            return; // hooked method is not current root method
        }

        RunFailure runFailure = new RunFailure();
        runFailure.setMessage(e.getClass().getCanonicalName() + ": " + e.getLocalizedMessage());
        runFailure.setStackTrace(ExceptionUtils.getStackTrace(e));
        LineReplacer replacer = new LineReplacer() {

            @Override
            public void replace(String classQualifiedName, String methodSimpleName, int line) {
                super.replace(classQualifiedName, methodSimpleName, line);
                if (StringUtils.equals(methodSimpleName, currentActualRootMethodSimpleName)) {
                    replaceMethodSimpleName(currentRunResult.getRootMethod().getSimpleName());
                }
            }
        };
        List<StackLine> stackLines = StackLineUtils.getStackLines(srcTree, e.getStackTrace(), replacer);
        for (StackLine stackLine : stackLines) {
            runFailure.addStackLine(stackLine);
        }
        currentRunResult.addRunFailure(runFailure);

        captureScreenForStackLines(rootMethod, Arrays.asList(stackLines), Arrays.asList(-1));
    }
538700
private void check(Class clazz) {

        final Constructor<?>[] constructors = clazz.getDeclaredConstructors();

        if (constructors.length > 1) {
            throw new AssertionError(clazz + " has more than one constructor");
        }

        final Constructor<?> constructor = constructors[0];

        constructor.setAccessible(true);

        if (!Modifier.isPrivate(constructor.getModifiers())) {
            throw new AssertionError("Constructor of " + clazz + " must be private");
        }

        final Class<?>[] parameterTypes = constructor.getParameterTypes();

        if (parameterTypes.length > 0) {
            if (expectedParameters == null) {
                throw new AssertionError(clazz + " has non-default constructor with some parameters");
            } else {
                if (!Arrays.equals(parameterTypes, expectedParameters)) {
                    throw new AssertionError("Expected constructor with parameters " + getReadableClassesOutput(expectedParameters) + " but found constructor with parameters " + getReadableClassesOutput(parameterTypes));
                } else {
                    return;
                }
            }
        }

        try {
            constructor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Can not instantiate instance of " + clazz, e);
        } catch (IllegalAccessException e) {
            // Fixed by setAccessible(true)
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            final Throwable cause = e.getCause();

            // It's okay case if we expect some exception from this constructor
            if (expectedTypeOfException != null || expectedExceptionMessage != null) {
                if (expectedTypeOfException != null && !expectedTypeOfException.equals(cause.getClass())) {
                    throw new IllegalStateException("For " + clazz + " expected exception of type = " + expectedTypeOfException + ", but was exception of type = " + e.getCause().getClass());
                }

                if (expectedExceptionMessage != null && !expectedExceptionMessage.equals(cause.getMessage())) {
                    throw new IllegalStateException("For " + clazz + " expected exception message = '" + expectedExceptionMessage + "', but was = '" + cause.getMessage() + "'", e.getCause());
                }

                // Everything is okay
            } else {
                throw new IllegalStateException("For " + clazz + " no exception was expected", e);
            }
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Looks like constructor of " + clazz + " is not default", e);
        }
    }
765119
public static Boolean assertTrue(Boolean value, String message) {
        if (!Boolean.valueOf(value))
            throw new IllegalStateException(message);

        return value;
    }
251838
public static void doAssert(boolean bSuccess)
    {
        if (!bSuccess)
        {
            Exception ex = new Exception();
            System.out.println("Assert False:");
            ex.printStackTrace();
            System.out.println("---Assert False");
        }
    }
191930
public final void evalError() {
    final List<EvaluationMonitor<POSSample>> listeners = new LinkedList<EvaluationMonitor<POSSample>>();
    listeners.add(new POSEvaluationErrorListener());
    final POSEvaluator evaluator = new POSEvaluator(this.posTagger,
        listeners.toArray(new POSTaggerEvaluationMonitor[listeners.size()]));
    try {
      evaluator.evaluate(this.testSamples);
    } catch (IOException e) {
      e.printStackTrace();
    }
    System.out.println(evaluator.getWordAccuracy());
  }
984256
function assertion(keys) {
  var missing = keys.filter(isMissing);

  if (missing.length) {
    throw new ReferenceError(format(message, missing.join(', ')));
  }
}
563472
function assert(t) {
	if (!t.result) {
		errorMessages.push(t.message);

		var errorDetail;
		if (t.expected === undefined && t.actual === undefined) {
			errorDetail = 'Test "' + testName + '" assertion failed' + (t.message ? ': "' + t.message + '"' : '');
		} else {
			errorDetail = 'Test "' + testName + '" assertion failed. Expected <' + t.expected + '> Actual <' + t.actual + '>' + (t.message ? ': "' + t.message + '"' : '');
		}

		errorDetails.push(errorDetail);
	}
}
871978
function (value, optMsg) {
                this._assertCount++;
                this._totalAssertCount++;
                if (value !== true) {
                    var msg = "Assert #" + this._assertCount + " failed";
                    if (optMsg) {
                        msg += " : " + optMsg;
                    }

                    this.raiseFailure(msg);

                    if (console && ariaUtilsType.isFunction(console.trace)) {
                        console.assert(false, "Stack trace for failed Assert #" + this._assertCount + " in test : ["
                                + this._currentTestName + "]");
                    }

                    // raise an exception to stop subsequent
                    throw {
                        name : this.ASSERT_FAILURE,
                        message : msg
                    };
                }
            }