@Test
public void toLowerCaseWithUnderscores() {

    assertNull(StringUtil.toLowerCaseWithUnderscores(null));
    assertEquals("", StringUtil.toLowerCaseWithUnderscores(""));
    assertEquals("a", StringUtil.toLowerCaseWithUnderscores("A"));
    assertEquals("a", StringUtil.toLowerCaseWithUnderscores("a"));
    assertEquals("ab", StringUtil.toLowerCaseWithUnderscores("AB"));
    assertEquals("ab", StringUtil.toLowerCaseWithUnderscores("Ab"));
    assertEquals("a_b", StringUtil.toLowerCaseWithUnderscores("aB"));
    assertEquals("ab", StringUtil.toLowerCaseWithUnderscores("ab"));
    assertEquals("a_b", StringUtil.toLowerCaseWithUnderscores("A_B"));
    assertEquals("a_b", StringUtil.toLowerCaseWithUnderscores("A_b"));
    assertEquals("a_b", StringUtil.toLowerCaseWithUnderscores("a_B"));
    assertEquals("a_b", StringUtil.toLowerCaseWithUnderscores("a_b"));
    assertEquals("a_bc", StringUtil.toLowerCaseWithUnderscores("aBc"));
    assertEquals("a_bc_def", StringUtil.toLowerCaseWithUnderscores("  aBc def "));
    assertEquals("a_bc_def", StringUtil.toLowerCaseWithUnderscores("aBcDef"));
    assertEquals("a_bc_def_ghi", StringUtil.toLowerCaseWithUnderscores("aBc def_ghi"));
    assertEquals("a_bc_def_ghi", StringUtil.toLowerCaseWithUnderscores("aBcDefGhi"));
    assertEquals("a_bc_def_ghi_123", StringUtil.toLowerCaseWithUnderscores("aBc def_ghi 123"));
    assertEquals("a_bc_def_ghi_123", StringUtil.toLowerCaseWithUnderscores("aBcDefGhi123"));
    assertEquals("a_bc_def_ghi_123", StringUtil.toLowerCaseWithUnderscores("aBcDEFGhi123"));
    assertEquals("123_a_bc_def_ghi", StringUtil.toLowerCaseWithUnderscores("123aBcDEFGhi")); // 数字开始
    // 保留下划线
    assertEquals("__ab__", StringUtil.toLowerCaseWithUnderscores("__AB__"));
    assertEquals("__ab__", StringUtil.toLowerCaseWithUnderscores("__Ab__"));
    assertEquals("__a_b__", StringUtil.toLowerCaseWithUnderscores("__aB__"));
    assertEquals("__ab__", StringUtil.toLowerCaseWithUnderscores("__ab__"));
    assertEquals("__a__b__", StringUtil.toLowerCaseWithUnderscores("__A__B__"));
    assertEquals("__a__b__", StringUtil.toLowerCaseWithUnderscores("__A__b__"));
    assertEquals("__a__b__", StringUtil.toLowerCaseWithUnderscores("__a__B__"));
    assertEquals("__a__b__", StringUtil.toLowerCaseWithUnderscores("__a__b__"));
    // 保留所有的分隔符
    assertEquals("..ab..", StringUtil.toLowerCaseWithUnderscores("..AB.."));
    assertEquals("..ab..", StringUtil.toLowerCaseWithUnderscores("..Ab.."));
    assertEquals("..a_b..", StringUtil.toLowerCaseWithUnderscores("..aB.."));
    assertEquals("..ab..", StringUtil.toLowerCaseWithUnderscores("..ab.."));
    assertEquals("..a..b..", StringUtil.toLowerCaseWithUnderscores("..A..B.."));
    assertEquals("..a..b..", StringUtil.toLowerCaseWithUnderscores("..A..b.."));
    assertEquals("..a..b..", StringUtil.toLowerCaseWithUnderscores("..a..B.."));
    assertEquals("..a..b..", StringUtil.toLowerCaseWithUnderscores("..a..b.."));
    assertEquals("..a..123_b..", StringUtil.toLowerCaseWithUnderscores("..A..123B.."));
    assertEquals("..a..123_b..", StringUtil.toLowerCaseWithUnderscores("..A..123b.."));
    assertEquals("..a..123_b..", StringUtil.toLowerCaseWithUnderscores("..a..123B.."));
    assertEquals("..a..123_b..", StringUtil.toLowerCaseWithUnderscores("..a..123b.."));
    assertEquals("_fmh.m._0.n", StringUtil.toLowerCaseWithUnderscores("_fmh.m._0.n"));
    assertEquals("aaa-bbb-ccc", StringUtil.toLowerCaseWithUnderscores("aaa-bbb-ccc"));
}