@Test public void checkNotNullWithMessage_throwsNullPointerExceptionWithMessage_whenNull() { final String message = "message"; thrown.expect(NullPointerException.class); thrown.expectMessage(message); Preconditions.checkNotNull(null, message); }
public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; }
Preconditions { public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } }
Preconditions { public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } private  Preconditions(); }
Preconditions { public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } private  Preconditions(); @NonNull static T get(@Nullable final T reference); static T checkNotNull(final T reference); static T checkNotNull(final T reference, @NonNull final String errorMessage); }
Preconditions { public static <T> T checkNotNull(final T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } private  Preconditions(); @NonNull static T get(@Nullable final T reference); static T checkNotNull(final T reference); static T checkNotNull(final T reference, @NonNull final String errorMessage);  }