### Question:
LKFileUtils { public static String basename(String path, boolean keepExt) { int idx = path.lastIndexOf(File.separatorChar); int idxUnix = path.lastIndexOf('/'); if (idxUnix > idx) { idx = idxUnix; } String name = idx >= 0 ? path.substring(idx + 1) : path; if (!keepExt) { int eidx = name.lastIndexOf('.'); if (eidx > 0) { name = name.substring(0, eidx); } } return name; } private  LKFileUtils(); @Deprecated static boolean isCompressed(File file); static Reader openInput(File file, Charset charset, CompressionMode compression); static Reader openInput(File file, CompressionMode compression); @SuppressWarnings("unused") static Reader openInput(File file); static Writer openOutput(File file, Charset charset, CompressionMode compression); @SuppressWarnings("unused") static Writer openOutput(File file, CompressionMode compression); @SuppressWarnings("unused") static Writer openOutput(File file); static ByteSource byteSource(File file); static ByteSource byteSource(File file, CompressionMode compression); static ByteSource byteSource(URL url, CompressionMode compression); static InputStream transparentlyDecompress(@WillCloseWhenClosed InputStream stream); static LongList readIdList(File file); static String basename(String path, boolean keepExt);  }### Answer:
@Test public void testNoopBasename() { assertThat(LKFileUtils.basename("foo", true), equalTo("foo")); assertThat(LKFileUtils.basename("foo", false), equalTo("foo")); }
@Test public void testNoPathPreservesExtension() { assertThat(LKFileUtils.basename("readme.txt", true), equalTo("readme.txt")); }
@Test public void testNoPathDropsExtension() { assertThat(LKFileUtils.basename("readme.txt", false), equalTo("readme")); }
@Test public void testPathRemoved() { assertThat(LKFileUtils.basename(String.format("foo%cbar.txt", File.separatorChar), true), equalTo("bar.txt")); assertThat(LKFileUtils.basename(String.format("foo%cbar.txt", File.separatorChar), false), equalTo("bar")); }
@Test public void testSlashPathRemoved() { assertThat(LKFileUtils.basename("foo/bar.txt", true), equalTo("bar.txt")); assertThat(LKFileUtils.basename("foo/bar.txt", false), equalTo("bar")); }
@Test public void testKeepDotfileName() { assertThat(LKFileUtils.basename(".dotfile", false), equalTo(".dotfile")); }