public static String format(final Date date, final String pattern) {
        if (date == null) {
            throw new NullPointerException("date must not be null");
        }
        if (pattern == null) {
            throw new NullPointerException("pattern must not be null");
        }
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }
@Test
    void testForNullPointerExceptionWithPattern() {
        assertThrows(NullPointerException.class, () -> {
            DateFormatUtils.format(null, "yyyyMdH");
        });
    }