I found out how you can test an exception or error: https://stackoverflow.com/a/54241438/6509751
But how do I test that the following assert works correctly?
void cannotBeNull(dynamic param) {
assert(param != null);
}
I tried the following, but it does not work. The assertion is simply printed out and the test fails:
void main() {
test('cannoBeNull assertion', () {
expect(cannotBeNull(null), throwsA(const TypeMatcher<AssertionError>()));
});
}