### Question:
Packages { public static String getPackageName(String filePath) { char sep = File.separatorChar; int n = filePath.lastIndexOf(sep); if (n == -1 && sep != '/') { sep = '/'; n = filePath.lastIndexOf(sep); } return n < 0 ? "." : filePath.substring(0, n).replace(sep, '.'); } private  Packages(); static String toClause(List<String> packages); static String getPackageName(String filePath); static boolean shouldBeExported(String packageName);  }### Answer:
@Test public void testPackageNameComputation() { assertThat(Packages.getPackageName("foo/bar/Baz.class")).isEqualTo("foo.bar"); assertThat(Packages.getPackageName("foo/bar/Baz.java")).isEqualTo("foo.bar"); assertThat(Packages.getPackageName("Baz.class")).isEqualTo("."); }