Instead of this custom code, use `@Test` with `expected` attribute