@Test public void throw_IllegalStateException_when_condition_is_false() { thrown.expect(IllegalStateException.class); thrown.expectMessage("must fail!"); Preconditions.checkState(false, "must fail!"); }
public static void checkState(boolean expression, String errorMessage) { if (!expression) { throw new IllegalStateException(errorMessage); } }
Preconditions { public static void checkState(boolean expression, String errorMessage) { if (!expression) { throw new IllegalStateException(errorMessage); } } }
Preconditions { public static void checkState(boolean expression, String errorMessage) { if (!expression) { throw new IllegalStateException(errorMessage); } } private  Preconditions(); }
Preconditions { public static void checkState(boolean expression, String errorMessage) { if (!expression) { throw new IllegalStateException(errorMessage); } } private  Preconditions(); static void checkState(boolean expression, String errorMessage); }
Preconditions { public static void checkState(boolean expression, String errorMessage) { if (!expression) { throw new IllegalStateException(errorMessage); } } private  Preconditions(); static void checkState(boolean expression, String errorMessage);  }