### Question:
Path { public static Path replace(String srcPrefix, Path descPrefix) { if ("".equals(srcPrefix) || descPrefix.startWith(srcPrefix)) { return descPrefix; } int prefixSize = srcPrefix.split(SystemConstant.PATH_SEPARATER_NO_REGEX).length; String[] descArray = descPrefix.fullPath.split(SystemConstant.PATH_SEPARATER_NO_REGEX); if (descArray.length <= prefixSize) { return new Path(srcPrefix); } StringContainer sc = new StringContainer(SystemConstant.PATH_SEPARATOR); sc.addTail(srcPrefix); for (int i = prefixSize; i < descArray.length; i++) { sc.addTail(descArray[i]); } return new Path(sc); } Path(StringContainer pathSc);  Path(String pathSc);  Path(String[] pathSc);  Path(String device, String measurement); static Path mergePath(Path prefix, Path suffix); static Path addPrefixPath(Path src, String prefix); static Path addPrefixPath(Path src, Path prefix); static Path replace(String srcPrefix, Path descPrefix); static Path replace(Path srcPrefix, Path descPrefix); String getFullPath(); String getDevice(); String getMeasurement(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equals(String obj); @Override String toString(); @Override Path clone(); boolean startWith(String prefix); boolean startWith(Path prefix);  }### Answer:
@Test public void replace() throws Exception { Path src = new Path("a.b.c"); Path rep1 = new Path(""); Path rep2 = new Path("d"); Path rep3 = new Path("d.e.f"); Path rep4 = new Path("d.e.f.g"); testPath(Path.replace(rep1, src), "a.b", "c", "a.b.c"); testPath(Path.replace(rep2, src), "d.b", "c", "d.b.c"); testPath(Path.replace(rep3, src), "d.e", "f", "d.e.f"); testPath(Path.replace(rep4, src), "d.e.f", "g", "d.e.f.g"); }