### Question:
ResourceLocator { public ResourceLocator cd(VirtualContainer vc) { if (vc == null) { throw new IllegalArgumentException("改变目录的容器对象（vc）为空"); } return cd(vc.getAbsLoc().getLoc()); } private  ResourceLocator();  ResourceLocator(OFDDir ofdDir);  ResourceLocator(VirtualContainer vc); ResourceLocator save(); ResourceLocator restore(); String toAbsolutePath(ST_Loc path); String toAbsolutePath(String path); ResourceLocator restWd(); ResourceLocator cd(VirtualContainer vc); ResourceLocator cd(String path); ResourceLocator cd(LinkedList<String> workDir, String path); boolean exist(LinkedList<String> workDir); boolean dirExit(LinkedList<String> workDir); String pwd(); String pwd(List<String> workDir); ST_Loc getAbsTo(ST_Loc to); R get(ST_Loc loc, Function<Element, R> mapper); R get(String loc, Function<Element, R> mapper); Path getFile(ST_Loc stLoc); VirtualContainer getContainer(LinkedList<String> workDir); VirtualContainer getContainer(String containerPath); static Pattern PtDoc; static Pattern PtSigns; static Pattern PtSign; static Pattern PtPages; static Pattern PtPage; static Pattern PtPageRes; static Pattern PtDocRes; }### Answer:
@Test void testCd() throws IOException { try (OFDReader reader = new OFDReader(src)) { OFDDir ofdDir = reader.getOFDDir(); ResourceLocator rl = new ResourceLocator(ofdDir); rl.cd("/Doc_0/Pages/"); assertEquals("/Doc_0/Pages", rl.pwd()); rl.restWd(); assertEquals("/", rl.pwd()); rl.cd("../"); assertEquals("/", rl.pwd()); rl.cd("./Doc_0/../"); assertEquals("/", rl.pwd()); rl.cd("Doc_0/Pages/Page_0"); assertEquals("/Doc_0/Pages/Page_0", rl.pwd()); rl.save(); rl.cd("/"); rl.restore(); assertEquals("/Doc_0/Pages/Page_0", rl.pwd()); rl.save(); rl.cd("/Doc_0"); rl.save(); rl.cd("Pages"); assertEquals("/Doc_0/Pages", rl.pwd()); rl.restore(); assertEquals("/Doc_0", rl.pwd()); rl.restore(); assertEquals("/Doc_0/Pages/Page_0", rl.pwd()); } }