I\'m writing a jUnit test for a constructor that parses a String and then check numerous things. When there\'s wrong data, for every thing, some IllegalArgumentException with di
If you have JUnit 4.7 or above you can use this (elegant) way:
@Rule
public ExpectedException exception = ExpectedException.none();
@Test
public void testRodneCisloRok(){
exception.expect(IllegalArgumentException.class);
exception.expectMessage("error1");
new RodneCislo("891415",dopocitej("891415"));
}