I have a class with an attribute I don't want to be null.
Si in the setter looks like this :
public void setFoo(String bar)
{
if (bar == null)
throw new IllegalArgumentException("Should not be null");
foo = bar;
}
And in my JUnit test case, I would like to assert that if I do obj.setFoo(null), it will fail. How can I do this?