Utils { public static void checkArgumentNotNull(Object object, String qualifier) { if (object == null) { String message = "You need to set a non null "; throw new IllegalArgumentException(message + qualifier); } }  static void checkArgumentNotNull(Object object, String qualifier);  }
@Test public void shouldThrowExcetionOnCheckArguments() throws Exception { String nullString = null; thrown.expect(IllegalArgumentException.class); thrown.expectMessage("You need to set a non null String"); Utils.checkArgumentNotNull(nullString, "String"); }