@Test public void testRequireFalse() { try { require(false); throw new RuntimeException("Expected an exception"); } catch (RuntimeException e) { assertThat(e).hasMessage("Invariant violation"); } }
public static void require(boolean check, @NotNull String format, Object... parameters) { if (check) { return; } report(new RuntimeException(safeFormat(format, parameters))); }
Invariant { public static void require(boolean check, @NotNull String format, Object... parameters) { if (check) { return; } report(new RuntimeException(safeFormat(format, parameters))); } }
Invariant { public static void require(boolean check, @NotNull String format, Object... parameters) { if (check) { return; } report(new RuntimeException(safeFormat(format, parameters))); }  }
Invariant { public static void require(boolean check, @NotNull String format, Object... parameters) { if (check) { return; } report(new RuntimeException(safeFormat(format, parameters))); }  @SuppressWarnings("Convert2Diamond") static void pushScope(); static void pushScope(boolean showOutput); static List<RuntimeException> popScope(); static int errorsInScope(); static void fail(@NotNull String format); static void fail(@NotNull String format, Object... parameters); static void require(boolean check, @NotNull String format, Object... parameters); static boolean failIf(boolean check, @NotNull String format, Object... parameters); static void require(boolean check); }
Invariant { public static void require(boolean check, @NotNull String format, Object... parameters) { if (check) { return; } report(new RuntimeException(safeFormat(format, parameters))); }  @SuppressWarnings("Convert2Diamond") static void pushScope(); static void pushScope(boolean showOutput); static List<RuntimeException> popScope(); static int errorsInScope(); static void fail(@NotNull String format); static void fail(@NotNull String format, Object... parameters); static void require(boolean check, @NotNull String format, Object... parameters); static boolean failIf(boolean check, @NotNull String format, Object... parameters); static void require(boolean check);  }