Checks { public static void checkNotNull(@Nullable Object object, @NonNull String message) { if (object == null) { throw new NullPointerException(message); } } private  Checks(); static void checkNotNull(@Nullable Object object, @NonNull String message);  }
@Test public void checkNotNullPositive() { checkNotNull(new Object(), "No exceptions please"); }
@Test public void checkNotNullNegative() { try { checkNotNull(null, "Throw me!"); failBecauseExceptionWasNotThrown(NullPointerException.class); } catch (NullPointerException expected) { assertThat(expected).hasMessage("Throw me!"); } }