Test if an assertion is thrown

Viewed 155

How do I test if an assertion is thrown by the method under test using junit? Heres the method I'm testing:

public int f(int i){
    assert i > 0;
    return i;
}

I'm using junit 4.12.

1 Answers
Related