@Test public void checkNotNullFormatted() { thrown.expect(NullPointerException.class); thrown.expectMessage("should be foo"); checkNotNull(null, "should be %s", "foo"); }
public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; }
Preconditions { public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; } }
Preconditions { public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; } private  Preconditions(); }
Preconditions { public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; } private  Preconditions(); static void checkArgument(boolean expression, String errorMessageTemplate,
                                   Object... errorMessageArgs); static T checkNotNull(T reference, String errorMessageTemplate,
                                   Object... errorMessageArgs); static void checkState(boolean expression, String errorMessageTemplate,
                                Object... errorMessageArgs); }
Preconditions { public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) { if (reference == null) { throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; } private  Preconditions(); static void checkArgument(boolean expression, String errorMessageTemplate,
                                   Object... errorMessageArgs); static T checkNotNull(T reference, String errorMessageTemplate,
                                   Object... errorMessageArgs); static void checkState(boolean expression, String errorMessageTemplate,
                                Object... errorMessageArgs);  }