### Question:
Rope { public Rope replace(int start, int end, String newString) { if (start < this.start || end > this.start + this.length) { throw new IllegalArgumentException( "[" + start + ", " + end + ") interval is out of bounds for current rope"); } if (this.isFull()) { Node newRoot = new Node(this.root.getNodeBody()); newRoot.replaceString(start, end, newString, false); return Rope.fromNode(newRoot); } else { Rope.Builder builder = new Rope.Builder(); this.root.subsequence(builder, this.start, this.start + start); builder.pushString(newString); this.root.subsequence(builder, this.start + end, this.start + this.length); return builder.build(); } } private  Rope(Node root, int start, int length); static Rope from(String s); int length(); Rope slice(int start, int end); Rope replace(int start, int end, String newString); Rope concat(Rope anotherRope); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testReplace() { Rope a = Rope.from("hello world"); Rope b = a.replace(1, 9, "era"); assertEquals(b.toString(), "herald"); assertEquals(a.toString(), "hello world"); assertNotEquals(a, b); Rope readme = Rope.from(text); Rope newLicense = readme.replace(32, 40, "UTSAVOZA"); assertEquals(readme.toString(), text); String newText = text.substring(0, 32) + "UTSAVOZA" + text.substring(40, text.length()); assertEquals(newLicense.toString(), newText); assertNotEquals(readme, newLicense); }