FileNameUtil { public static String getBaseName(final String file) { final int i = file.lastIndexOf('.'); if (i > 0) { return file.substring(0, i); } return file; }  static String getBaseName(final String file); static String getExtension(final String file);  }
@Test public void testSimple() { Assert.assertEquals("001", FileNameUtil.getBaseName("001.dat")); Assert.assertEquals("001.001", FileNameUtil.getBaseName("001.001.dat")); Assert.assertEquals("001", FileNameUtil.getBaseName("001")); }
@Test void testSimple() { Assertions.assertThat(FileNameUtil.getBaseName("001.dat")).isEqualTo("001"); assertThat(FileNameUtil.getBaseName("001.001.dat")).isEqualTo("001.001"); assertThat(FileNameUtil.getBaseName("001")).isEqualTo("001"); }