How-to articles, tricks, and solutions about ASSERT

How to assert that a certain exception is thrown in JUnit tests?

To assert that a certain exception is thrown in a JUnit test, you can use the @Test annotation's expected attribute. Here's an example:

PHPUnit: assert two arrays are equal, but order of elements not important

You can use the assertEqualsCanonicalizing or assertEqualsIgnoringCase methods to compare two arrays and ignore the order of the elements.

What is the use of "assert" in Python?

In Python, the assert statement is used to check if a certain condition is true, and if it is not true, raise an exception.