How Do I Catch Errors for JUnit Tests? : I'm writing tests for some code I was given. There is a constructor that takes and int as the first parameter. I want to test that it gives an error if something such as a boolean is passed in so I wrote this code.

        try
        {
            nanReview = new WorkshopReview(true, "test");
        }
        catch (Error err)
        {
            assertEquals(err.getMessage(), "incompatible types: boolean cannot be converted to int");
        }

When I run the test it just throws the error into the console again, shouldn't the test pass at this point because it throws the expected error message?

How do I go about testing stuff like this / should I even be testing this in the first place?