Skip to content

Commit c578216

Browse files
committed
Merge pull request #30 from stleary/confirmValueToStringFix
Fix tabs, add valueToString() test to JSONObjectTest
2 parents 6406c7a + 38cbc31 commit c578216

File tree

2 files changed

+227
-208
lines changed

2 files changed

+227
-208
lines changed

JSONArrayTest.java

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -93,62 +93,62 @@ public void badObject() {
9393
*/
9494
@Test
9595
public void verifyConstructor() {
96-
97-
final JSONArray expected = new JSONArray("[10]");
98-
99-
@SuppressWarnings("rawtypes")
100-
Collection myRawC = Collections.singleton(Integer.valueOf(10));
101-
JSONArray jaRaw = new JSONArray(myRawC);
102-
103-
Collection<Integer> myCInt = Collections.singleton(Integer.valueOf(10));
104-
JSONArray jaInt = new JSONArray(myCInt);
105-
106-
Collection<Object> myCObj = Collections.singleton((Object) Integer
107-
.valueOf(10));
108-
JSONArray jaObj = new JSONArray(myCObj);
109-
110-
assertTrue(
111-
"The RAW Collection should give me the same as the Typed Collection",
112-
expected.similar(jaRaw));
113-
assertTrue(
114-
"The RAW Collection should give me the same as the Typed Collection",
115-
expected.similar(jaInt));
116-
assertTrue(
117-
"The RAW Collection should give me the same as the Typed Collection",
118-
expected.similar(jaObj));
96+
97+
final JSONArray expected = new JSONArray("[10]");
98+
99+
@SuppressWarnings("rawtypes")
100+
Collection myRawC = Collections.singleton(Integer.valueOf(10));
101+
JSONArray jaRaw = new JSONArray(myRawC);
102+
103+
Collection<Integer> myCInt = Collections.singleton(Integer.valueOf(10));
104+
JSONArray jaInt = new JSONArray(myCInt);
105+
106+
Collection<Object> myCObj = Collections.singleton((Object) Integer
107+
.valueOf(10));
108+
JSONArray jaObj = new JSONArray(myCObj);
109+
110+
assertTrue(
111+
"The RAW Collection should give me the same as the Typed Collection",
112+
expected.similar(jaRaw));
113+
assertTrue(
114+
"The RAW Collection should give me the same as the Typed Collection",
115+
expected.similar(jaInt));
116+
assertTrue(
117+
"The RAW Collection should give me the same as the Typed Collection",
118+
expected.similar(jaObj));
119119
}
120120

121121
/**
122122
* Verifies that the put Collection has backwards compatability with RAW types pre-java5.
123123
*/
124124
@Test
125125
public void verifyPutCollection() {
126-
127-
final JSONArray expected = new JSONArray("[[10]]");
128-
129-
@SuppressWarnings("rawtypes")
130-
Collection myRawC = Collections.singleton(Integer.valueOf(10));
131-
JSONArray jaRaw = new JSONArray();
132-
jaRaw.put(myRawC);
133-
134-
Collection<Object> myCObj = Collections.singleton((Object) Integer
135-
.valueOf(10));
136-
JSONArray jaObj = new JSONArray();
137-
jaObj.put(myCObj);
138-
139-
Collection<Integer> myCInt = Collections.singleton(Integer.valueOf(10));
140-
JSONArray jaInt = new JSONArray();
141-
jaInt.put(myCInt);
142-
143-
assertTrue(
144-
"The RAW Collection should give me the same as the Typed Collection",
145-
expected.similar(jaRaw));
146-
assertTrue(
147-
"The RAW Collection should give me the same as the Typed Collection",
148-
expected.similar(jaObj));
149-
assertTrue(
150-
"The RAW Collection should give me the same as the Typed Collection",
151-
expected.similar(jaInt));
126+
127+
final JSONArray expected = new JSONArray("[[10]]");
128+
129+
@SuppressWarnings("rawtypes")
130+
Collection myRawC = Collections.singleton(Integer.valueOf(10));
131+
JSONArray jaRaw = new JSONArray();
132+
jaRaw.put(myRawC);
133+
134+
Collection<Object> myCObj = Collections.singleton((Object) Integer
135+
.valueOf(10));
136+
JSONArray jaObj = new JSONArray();
137+
jaObj.put(myCObj);
138+
139+
Collection<Integer> myCInt = Collections.singleton(Integer.valueOf(10));
140+
JSONArray jaInt = new JSONArray();
141+
jaInt.put(myCInt);
142+
143+
assertTrue(
144+
"The RAW Collection should give me the same as the Typed Collection",
145+
expected.similar(jaRaw));
146+
assertTrue(
147+
"The RAW Collection should give me the same as the Typed Collection",
148+
expected.similar(jaObj));
149+
assertTrue(
150+
"The RAW Collection should give me the same as the Typed Collection",
151+
expected.similar(jaInt));
152152
}
153153

154154

@@ -157,41 +157,41 @@ public void verifyPutCollection() {
157157
*/
158158
@Test
159159
public void verifyPutMap() {
160-
161-
final JSONArray expected = new JSONArray("[{\"myKey\":10}]");
162-
163-
@SuppressWarnings("rawtypes")
164-
Map myRawC = Collections.singletonMap("myKey", Integer.valueOf(10));
165-
JSONArray jaRaw = new JSONArray();
166-
jaRaw.put(myRawC);
167-
168-
Map<String, Object> myCStrObj = Collections.singletonMap("myKey",
169-
(Object) Integer.valueOf(10));
170-
JSONArray jaStrObj = new JSONArray();
171-
jaStrObj.put(myCStrObj);
172-
173-
Map<String, Integer> myCStrInt = Collections.singletonMap("myKey",
174-
Integer.valueOf(10));
175-
JSONArray jaStrInt = new JSONArray();
176-
jaStrInt.put(myCStrInt);
177-
178-
Map<?, ?> myCObjObj = Collections.singletonMap((Object) "myKey",
179-
(Object) Integer.valueOf(10));
180-
JSONArray jaObjObj = new JSONArray();
181-
jaObjObj.put(myCObjObj);
182-
183-
assertTrue(
184-
"The RAW Collection should give me the same as the Typed Collection",
185-
expected.similar(jaRaw));
186-
assertTrue(
187-
"The RAW Collection should give me the same as the Typed Collection",
188-
expected.similar(jaStrObj));
189-
assertTrue(
190-
"The RAW Collection should give me the same as the Typed Collection",
191-
expected.similar(jaStrInt));
192-
assertTrue(
193-
"The RAW Collection should give me the same as the Typed Collection",
194-
expected.similar(jaObjObj));
160+
161+
final JSONArray expected = new JSONArray("[{\"myKey\":10}]");
162+
163+
@SuppressWarnings("rawtypes")
164+
Map myRawC = Collections.singletonMap("myKey", Integer.valueOf(10));
165+
JSONArray jaRaw = new JSONArray();
166+
jaRaw.put(myRawC);
167+
168+
Map<String, Object> myCStrObj = Collections.singletonMap("myKey",
169+
(Object) Integer.valueOf(10));
170+
JSONArray jaStrObj = new JSONArray();
171+
jaStrObj.put(myCStrObj);
172+
173+
Map<String, Integer> myCStrInt = Collections.singletonMap("myKey",
174+
Integer.valueOf(10));
175+
JSONArray jaStrInt = new JSONArray();
176+
jaStrInt.put(myCStrInt);
177+
178+
Map<?, ?> myCObjObj = Collections.singletonMap((Object) "myKey",
179+
(Object) Integer.valueOf(10));
180+
JSONArray jaObjObj = new JSONArray();
181+
jaObjObj.put(myCObjObj);
182+
183+
assertTrue(
184+
"The RAW Collection should give me the same as the Typed Collection",
185+
expected.similar(jaRaw));
186+
assertTrue(
187+
"The RAW Collection should give me the same as the Typed Collection",
188+
expected.similar(jaStrObj));
189+
assertTrue(
190+
"The RAW Collection should give me the same as the Typed Collection",
191+
expected.similar(jaStrInt));
192+
assertTrue(
193+
"The RAW Collection should give me the same as the Typed Collection",
194+
expected.similar(jaObjObj));
195195
}
196196

197197
/**

0 commit comments

Comments
 (0)