I have a set method. The set method accept just a few Strings. If the String is not acceptable the set method gives out an ColorException (Own Exception). How do I make a JUnit test to test if I get a Color Exception? Here my testclass at the moment (I tried it with try catch ...):
@Test // set&check foreground colors for drawings public void setgetFGCol() { try { draw.setFGColor("Red"); assertEquals(draw.getFGColor(), "Red"); draw.setFGColor("Not Acceptable String"); // fail("handle fail?"); } catch (ColorException e) { System.out.println("Dies ist keine bekannte Farbe"); } }