Skip to content

Commit 86bdcd5

Browse files
committed
update Java version
1 parent dda9ef5 commit 86bdcd5

File tree

3 files changed

+53
-51
lines changed

3 files changed

+53
-51
lines changed

src/test/java/com/upokecenter/test/CBORObjectTest.java

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8838,19 +8838,19 @@ public void TestKeepKeyOrder() {
88388838
for (CBORObject key : cbor.getKeys()) {
88398839
list.add(key);
88408840
}
8841-
Assert.assertEquals(CBORObject.FromObject("1"),list.get(0));
8842-
Assert.assertEquals(CBORObject.FromObject("2"),list.get(1));
8843-
Assert.assertEquals(CBORObject.FromObject("3"),list.get(2));
8841+
Assert.assertEquals(CBORObject.FromObject("1"), list.get(0));
8842+
Assert.assertEquals(CBORObject.FromObject("2"), list.get(1));
8843+
Assert.assertEquals(CBORObject.FromObject("3"), list.get(2));
88448844

88458845
jsonstring = "{\"3\":0,\"2\":0,\"1\":0}";
88468846
cbor = CBORObject.FromJSONString(jsonstring, joptions);
88478847
list = new ArrayList<CBORObject>();
88488848
for (CBORObject key : cbor.getKeys()) {
88498849
list.add(key);
88508850
}
8851-
Assert.assertEquals(CBORObject.FromObject("3"),list.get(0));
8852-
Assert.assertEquals(CBORObject.FromObject("2"),list.get(1));
8853-
Assert.assertEquals(CBORObject.FromObject("1"),list.get(2));
8851+
Assert.assertEquals(CBORObject.FromObject("3"), list.get(0));
8852+
Assert.assertEquals(CBORObject.FromObject("2"), list.get(1));
8853+
Assert.assertEquals(CBORObject.FromObject("1"), list.get(2));
88548854

88558855
jsonstring = "{\"3\":0,\"2\":0,\"1\":0}";
88568856
bytes = DataUtilities.GetUtf8Bytes(jsonstring, false);
@@ -8859,9 +8859,9 @@ public void TestKeepKeyOrder() {
88598859
for (CBORObject key : cbor.getKeys()) {
88608860
list.add(key);
88618861
}
8862-
Assert.assertEquals(CBORObject.FromObject("3"),list.get(0));
8863-
Assert.assertEquals(CBORObject.FromObject("2"),list.get(1));
8864-
Assert.assertEquals(CBORObject.FromObject("1"),list.get(2));
8862+
Assert.assertEquals(CBORObject.FromObject("3"), list.get(0));
8863+
Assert.assertEquals(CBORObject.FromObject("2"), list.get(1));
8864+
Assert.assertEquals(CBORObject.FromObject("1"), list.get(2));
88658865
}
88668866

88678867
@Test
@@ -9372,67 +9372,67 @@ public void TestApplyJSONPatch() {
93729372
CBORObject.NewArray().Add(1),
93739373
patch);
93749374

9375-
TestApplyJSONPatchOpReplace(
9375+
this.TestApplyJSONPatchOpReplace(
93769376
CBORObject.NewArray().Add(1).Add(3),
93779377
CBORObject.NewArray().Add(1).Add(2),
93789378
"/1",
93799379
3);
9380-
TestApplyJSONPatchOpReplace(
9380+
this.TestApplyJSONPatchOpReplace(
93819381
CBORObject.NewArray().Add(3).Add(2),
93829382
CBORObject.NewArray().Add(1).Add(2),
93839383
"/0",
93849384
3);
9385-
TestApplyJSONPatchOpReplace(
9385+
this.TestApplyJSONPatchOpReplace(
93869386
null,
93879387
CBORObject.NewArray().Add(1).Add(2),
93889388
"/00",
93899389
3);
9390-
TestApplyJSONPatchOpReplace(
9390+
this.TestApplyJSONPatchOpReplace(
93919391
null,
93929392
CBORObject.NewArray().Add(1).Add(2),
93939393
"/00000",
93949394
3);
9395-
TestApplyJSONPatchOpReplace(
9395+
this.TestApplyJSONPatchOpReplace(
93969396
CBORObject.NewMap().Add("f1", "f2").Add("f3", 3),
93979397
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
93989398
"/f3",
93999399
3);
9400-
TestApplyJSONPatchOpReplace(
9400+
this.TestApplyJSONPatchOpReplace(
94019401
CBORObject.NewMap().Add("f1", 3).Add("f3", "f4"),
94029402
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94039403
"/f1",
94049404
3);
9405-
TestApplyJSONPatchOpReplace(
9405+
this.TestApplyJSONPatchOpReplace(
94069406
null,
94079407
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94089408
"/foo",
94099409
3);
9410-
TestApplyJSONPatchOpReplace(
9410+
this.TestApplyJSONPatchOpReplace(
94119411
null,
94129412
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94139413
"/f1/xyz",
94149414
3);
9415-
TestApplyJSONPatchOpReplace(
9415+
this.TestApplyJSONPatchOpReplace(
94169416
null,
94179417
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94189418
"/f1/",
94199419
3);
9420-
TestApplyJSONPatchOpReplace(
9420+
this.TestApplyJSONPatchOpReplace(
94219421
null,
94229422
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94239423
"/0",
94249424
3);
9425-
TestApplyJSONPatchOpReplace(
9425+
this.TestApplyJSONPatchOpReplace(
94269426
null,
94279427
CBORObject.NewMap().Add("f1", "f2").Add("f3", "f4"),
94289428
"/-",
94299429
3);
9430-
TestApplyJSONPatchOpReplace(
9430+
this.TestApplyJSONPatchOpReplace(
94319431
null,
94329432
CBORObject.NewArray().Add(1).Add(2),
94339433
"/-",
94349434
3);
9435-
TestApplyJSONPatchOpReplace(
9435+
this.TestApplyJSONPatchOpReplace(
94369436
null,
94379437
CBORObject.NewArray().Add(1).Add(2),
94389438
"/foo",
@@ -9545,7 +9545,7 @@ public void TestApplyJSONPatch() {
95459545
@Test
95469546
public void TestAtJSONPointer() {
95479547
CBORObject cbor;
9548-
cbor=CBORObject.FromObject("xyz");
9548+
cbor = CBORObject.FromObject("xyz");
95499549
Assert.assertEquals(cbor, cbor.AtJSONPointer(""));
95509550
try {
95519551
cbor.AtJSONPointer(null);
@@ -9691,7 +9691,7 @@ public void TestAtJSONPointer() {
96919691
throw new IllegalStateException("", ex);
96929692
}
96939693
cbor.Add(3);
9694-
Assert.assertEquals(cbor.get(0),cbor.AtJSONPointer("/0"));
9694+
Assert.assertEquals(cbor.get(0), cbor.AtJSONPointer("/0"));
96959695
try {
96969696
cbor.AtJSONPointer("/1");
96979697
Assert.fail("Should have failed");
@@ -9710,7 +9710,7 @@ public void TestAtJSONPointer() {
97109710
Assert.fail(ex.toString());
97119711
throw new IllegalStateException("", ex);
97129712
}
9713-
cbor=CBORObject.NewMap().Add("foo",0);
9713+
cbor = CBORObject.NewMap().Add("foo", 0);
97149714
Assert.assertEquals(cbor, cbor.AtJSONPointer(""));
97159715
try {
97169716
cbor.AtJSONPointer(null);
@@ -9730,7 +9730,7 @@ public void TestAtJSONPointer() {
97309730
Assert.fail(ex.toString());
97319731
throw new IllegalStateException("", ex);
97329732
}
9733-
Assert.assertEquals(cbor.get("foo"),cbor.AtJSONPointer("/foo"));
9733+
Assert.assertEquals(cbor.get("foo"), cbor.AtJSONPointer("/foo"));
97349734
try {
97359735
cbor.AtJSONPointer("/bar");
97369736
Assert.fail("Should have failed");
@@ -9740,19 +9740,20 @@ public void TestAtJSONPointer() {
97409740
Assert.fail(ex.toString());
97419741
throw new IllegalStateException("", ex);
97429742
}
9743-
cbor=CBORObject.NewMap().Add("f~o",0);
9744-
Assert.assertEquals(cbor.get("f~o"),cbor.AtJSONPointer("/f~0o"));
9745-
cbor=CBORObject.NewMap().Add("f~0o",0);
9746-
Assert.assertEquals(cbor.get("f~0o"),cbor.AtJSONPointer("/f~00o"));
9747-
cbor=CBORObject.NewMap().Add("f~1o",0);
9748-
Assert.assertEquals(cbor.get("f~1o"),cbor.AtJSONPointer("/f~01o"));
9749-
cbor=CBORObject.NewMap().Add("f/o",0);
9750-
Assert.assertEquals(cbor.get("f/o"),cbor.AtJSONPointer("/f~1o"));
9751-
cbor=CBORObject.NewMap().Add("foo",CBORObject.NewMap().Add("bar",345));
9743+
cbor = CBORObject.NewMap().Add("f~o", 0);
9744+
Assert.assertEquals(cbor.get("f~o"), cbor.AtJSONPointer("/f~0o"));
9745+
cbor = CBORObject.NewMap().Add("f~0o", 0);
9746+
Assert.assertEquals(cbor.get("f~0o"), cbor.AtJSONPointer("/f~00o"));
9747+
cbor = CBORObject.NewMap().Add("f~1o", 0);
9748+
Assert.assertEquals(cbor.get("f~1o"), cbor.AtJSONPointer("/f~01o"));
9749+
cbor = CBORObject.NewMap().Add("f/o", 0);
9750+
Assert.assertEquals(cbor.get("f/o"), cbor.AtJSONPointer("/f~1o"));
9751+
cbor = CBORObject.NewMap().Add("foo", CBORObject.NewMap().Add("bar",
9752+
345));
97529753

9753-
Assert.assertEquals(CBORObject.FromObject(345),cbor.AtJSONPointer("/foo/bar"));
9754-
cbor=CBORObject.NewMap().Add("foo",CBORObject.NewArray().Add(678));
9755-
Assert.assertEquals(CBORObject.FromObject(678),cbor.AtJSONPointer("/foo/0"));
9754+
Assert.assertEquals(CBORObject.FromObject(345), cbor.AtJSONPointer("/foo/bar"));
9755+
cbor = CBORObject.NewMap().Add("foo", CBORObject.NewArray().Add(678));
9756+
Assert.assertEquals(CBORObject.FromObject(678), cbor.AtJSONPointer("/foo/0"));
97569757
try {
97579758
cbor.AtJSONPointer("/foo/1");
97589759
Assert.fail("Should have failed");
@@ -9780,10 +9781,10 @@ public void TestAtJSONPointer() {
97809781
Assert.fail(ex.toString());
97819782
throw new IllegalStateException("", ex);
97829783
}
9783-
cbor=CBORObject.NewMap().Add("-",0);
9784-
Assert.assertEquals(cbor.get("-"),cbor.AtJSONPointer("/-"));
9784+
cbor = CBORObject.NewMap().Add("-", 0);
9785+
Assert.assertEquals(cbor.get("-"), cbor.AtJSONPointer("/-"));
97859786
cbor = CBORObject.NewMap().Add("", 0);
9786-
Assert.assertEquals(cbor.get(""),cbor.AtJSONPointer("/"));
9787+
Assert.assertEquals(cbor.get(""), cbor.AtJSONPointer("/"));
97879788
}
97889789

97899790
@Test

src/test/java/com/upokecenter/test/CBORTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4917,21 +4917,21 @@ public static boolean CheckUtf16(String str) {
49174917
@Test
49184918
public void TestWriteBasic() {
49194919
JSONOptions jsonop1 = new JSONOptions("writebasic=true");
4920-
String json=CBORObject.FromObject("\uD800\uDC00").ToJSONString(jsonop1);
4921-
Assert.assertEquals("\"\\uD800\\uDC00\"",json);
4922-
json=CBORObject.FromObject("\u0800\u0C00").ToJSONString(jsonop1);
4923-
Assert.assertEquals("\"\\u0800\\u0C00\"",json);
4924-
json=CBORObject.FromObject("\u0085\uFFFF").ToJSONString(jsonop1);
4925-
Assert.assertEquals("\"\\u0085\\uFFFF\"",json);
4920+
String json = CBORObject.FromObject("\uD800\uDC00").ToJSONString(jsonop1);
4921+
Assert.assertEquals("\"\\uD800\\uDC00\"", json);
4922+
json = CBORObject.FromObject("\u0800\u0C00").ToJSONString(jsonop1);
4923+
Assert.assertEquals("\"\\u0800\\u0C00\"", json);
4924+
json = CBORObject.FromObject("\u0085\uFFFF").ToJSONString(jsonop1);
4925+
Assert.assertEquals("\"\\u0085\\uFFFF\"", json);
49264926
RandomGenerator rg = new RandomGenerator();
49274927
for (int i = 0; i < 1000; ++i) {
49284928
String rts = RandomObjects.RandomTextString(rg);
49294929
CBORObject cbor = CBORObject.FromObject(rts);
49304930
json = cbor.ToJSONString(jsonop1);
49314931
// Check that the JSON contains only ASCII code points
4932-
for (int j = 0;j<json.length(); ++j) {
4932+
for (int j = 0; j < json.length(); ++j) {
49334933
char c = json.charAt(j);
4934-
if ((c<0x20 && c != 0x09 && c != 0x0a && c != 0x0d) || c >= 0x7f) {
4934+
if ((c < 0x20 && c != 0x09 && c != 0x0a && c != 0x0d) || c >= 0x7f) {
49354935
Assert.fail(rts);
49364936
}
49374937
}
@@ -4999,7 +4999,7 @@ public void TestRandomJSON() {
49994999
JSONOptions jsonop4 = new JSONOptions("numberconversion=double");
50005000
for (int i = 0; i < 200; ++i) {
50015001
byte[] jsonbytes = jsongen.Generate(rg);
5002-
//System.out.println("" + i + " len=" + jsonbytes.length);
5002+
// System.out.println("" + i + " len=" + jsonbytes.length);
50035003
JSONOptions currop = null;
50045004
try {
50055005
currop = jsonop1;

src/test/java/com/upokecenter/test/JSONWithComments.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ private CBORObject NextJSONString() {
6161
if (escaped) {
6262
return CBORObject.FromJSONString(js.substring(
6363
startIndex - 1, (
64-
startIndex - 1)+(endIndex - (startIndex - 1)))); } return
64+
startIndex - 1)+(endIndex - (startIndex - 1)))); }
65+
return
6566
CBORObject.FromObject(js.substring(startIndex, (startIndex)+((endIndex - 1) - startIndex)));
6667
} else if (c == '\\') {
6768
this.index = idx++;

0 commit comments

Comments
 (0)