@Test
public void testNewDateFormat() throws ParseException {

    assertThatIllegalArgumentException().isThrownBy(() -> of(FRENCH, "c", null).newDateFormat());
    assertThatIllegalArgumentException().isThrownBy(() -> of(null, "c", null).newDateFormat());
    Date date = DateUtil.parse("2000-01-01");
    DateFormat f1 = of(FRANCE, null, null).newDateFormat();
    assertThat(f1.format(date)).isEqualTo("1 janv. 2000");
    assertThat(f1.parse("1 janv. 2000")).isEqualTo(date);
    DateFormat f2 = of(US, null, null).newDateFormat();
    assertThat(f2.format(date)).isEqualTo("Jan 1, 2000");
    assertThat(f2.parse("Jan 1, 2000")).isEqualTo(date);
    DateFormat f3 = of(FRANCE, "yyyy-MMM", null).newDateFormat();
    assertThat(f3.format(date)).isEqualTo("2000-janv.");
    assertThat(f3.parse("2000-janv.")).isEqualTo(date);
    DateFormat f4 = of(US, "yyyy-MMM", null).newDateFormat();
    assertThat(f4.format(date)).isEqualTo("2000-Jan");
    assertThat(f4.parse("2000-Jan")).isEqualTo(date);
    BiConsumer<DataFormat, DateFormat> equivalence = (o, r) -> {
        try {
            DateFormat l = o.newDateFormat();
            assertThat(l.parseObject(r.format(date))).isEqualTo(date);
            assertThat(r.parseObject(l.format(date))).isEqualTo(date);
        } catch (ParseException ex) {
            throw new RuntimeException(ex);
        }
    };
    equivalence.accept(of(FRANCE, "yyyy-MMM", null), new SimpleDateFormat("yyyy-MMM", FRANCE));
    equivalence.accept(of(null, "yyyy-MMM", null), new SimpleDateFormat("yyyy-MMM"));
    equivalence.accept(of(FRANCE, null, null), SimpleDateFormat.getDateInstance(DateFormat.DEFAULT, FRANCE));
    equivalence.accept(of(null, null, null), SimpleDateFormat.getDateInstance());
}