MagicCommitPaths { public static String lastElement(List<String> strings) { checkArgument(!strings.isEmpty(), "empty list"); return strings.get(strings.size() - 1); } private  MagicCommitPaths(); static List<String> splitPathToElements(Path path); static boolean isMagicPath(List<String> elements); static boolean containsBasePath(List<String> elements); static int magicElementIndex(List<String> elements); static List<String> magicPathParents(List<String> elements); static List<String> magicPathChildren(List<String> elements); static List<String> basePathChildren(List<String> elements); static String elementsToKey(List<String> elements); static String filename(List<String> elements); static String lastElement(List<String> strings); static Path magicSubdir(Path destDir); static List<String> finalDestination(List<String> elements);  }
@Test public void testLastElementEmpty() throws Throwable { intercept(IllegalArgumentException.class, () -> lastElement(new ArrayList<>(0))); }
@Test public void testLastElementSingle() { assertEquals("first", lastElement(l("first"))); }
@Test public void testLastElementDouble() { assertEquals("2", lastElement(l("first", "2"))); }