DefaultMdcEntry implements MdcEntry { public static DefaultMdcEntry of(final CharSequence key, @Nullable final CharSequence value) { return new DefaultMdcEntry(argumentNotEmpty(key, "key").toString(), null != value ? value.toString() : null); } private  DefaultMdcEntry(final String key, @Nullable final String value); static DefaultMdcEntry of(final CharSequence key, @Nullable final CharSequence value); @Override String getKey(); @Nullable @Override String getValueOrNull(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void getInstanceWithNullKey() { assertThatNullPointerException() .isThrownBy(() -> DefaultMdcEntry.of(null, "bar")) .withMessage("The key must not be null!") .withNoCause(); }
@Test public void getInstanceWithEmptyKey() { assertThatIllegalArgumentException() .isThrownBy(() -> DefaultMdcEntry.of("", "bar")) .withMessage("The argument 'key' must not be empty!") .withNoCause(); }