We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2eed4be commit adb3118Copy full SHA for adb3118
1 file changed
src/test/org/json/junit/JSONPointerTest.java
@@ -2,6 +2,7 @@
2
3
import static org.junit.Assert.assertEquals;
4
import static org.junit.Assert.assertSame;
5
+import static org.junit.Assert.fail;
6
7
import org.json.JSONObject;
8
import org.json.JSONPointer;
@@ -143,5 +144,16 @@ public void toURIFragment() {
143
144
assertEquals("#/g%7Ch", new JSONPointer("/g|h").toURIFragment());
145
assertEquals("#/m%7En", new JSONPointer("/m~n").toURIFragment());
146
}
147
+
148
+ @Test
149
+ public void tokenListIsCopiedInConstructor() {
150
+ JSONPointer.Builder b = JSONPointer.builder().append("key1");
151
+ JSONPointer jp1 = b.build();
152
+ b.append("key2");
153
+ JSONPointer jp2 = b.build();
154
+ if(jp1.toString().equals(jp2.toString())) {
155
+ fail("Oops, my pointers are sharing a backing array");
156
+ }
157
158
159
0 commit comments