public static List<String> finalDestination(List<String> elements) {
    if (isMagicPath(elements)) {
      List<String> destDir = magicPathParents(elements);
      List<String> children = magicPathChildren(elements);
      checkArgument(!children.isEmpty(), "No path found under the prefix " +
          MAGIC_PATH_PREFIX);
      ArrayList<String> dest = new ArrayList<>(destDir);
      if (containsBasePath(children)) {
        // there's a base marker in the path
        List<String> baseChildren = basePathChildren(children);
        checkArgument(!baseChildren.isEmpty(),
            "No path found under " + BASE);
        dest.addAll(baseChildren);
      } else {
        dest.add(filename(children));
      }
      return dest;
    } else {
      return elements;
    }
  }
@Test
  public void testFinalDestinationBaseSubdirsChild() {
    assertEquals(l("2", "3.txt"),
        finalDestination(l(MAGIC_PATH_PREFIX, "4", BASE, "2", "3.txt")));
  }