Skip to content

Commit b4068b3

Browse files
committed
clean code
1 parent d692c7e commit b4068b3

File tree

7 files changed

+20
-25
lines changed

7 files changed

+20
-25
lines changed

json-smart-mini/src/main/java/net/minidev/json/parser/JSONParserStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.util.List;
88
import java.util.Map;
99

10-
import net.minidev.json.parser.ContainerFactory;
11-
import net.minidev.json.parser.ParseException;
10+
11+
1212
import static net.minidev.json.parser.ParseException.*;
1313
import static net.minidev.json.parser.JSONParser.*;
1414

json-smart/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
<artifactId>json-smart</artifactId>
77
<packaging>bundle</packaging>
8-
<version>1.3.2</version>
98

109
<parent>
1110
<groupId>net.minidev</groupId>

json-smart/src/test/java/net/minidev/json/test/Issue26.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public void setPlugin(boolean plugin) {
5757
public void testIssue26() {
5858
App dbApp = new App();
5959
dbApp.setSoftname("sssssssssss");
60-
System.out.println();
6160
assertTrue(JSONValue.toJSONString(dbApp).contains("sssssssssss"));
6261
}
6362

json-smart/src/test/java/net/minidev/json/test/TestBigValue.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import java.math.BigInteger;
55
import java.util.HashMap;
66

7+
import org.junit.Test;
8+
79
import net.minidev.json.JSONObject;
810
import net.minidev.json.JSONValue;
11+
import net.minidev.json.parser.JSONParser;
912
import junit.framework.TestCase;
1013

1114
public class TestBigValue extends TestCase {
@@ -14,6 +17,7 @@ public class TestBigValue extends TestCase {
1417
/**
1518
* test BigDecimal serialization
1619
*/
20+
@Test
1721
public void testBigDecimal() {
1822
HashMap<String, Object> map = new HashMap<String, Object>();
1923
BigDecimal bigDec = new BigDecimal(bigStr + "." + bigStr);
@@ -29,6 +33,7 @@ public void testBigDecimal() {
2933
/**
3034
* test BigInteger serialization
3135
*/
36+
@Test
3237
public void testBigInteger() {
3338
HashMap<String, Object> map = new HashMap<String, Object>();
3439
BigInteger bigInt = new BigInteger(bigStr);
@@ -45,10 +50,12 @@ public void testBigInteger() {
4550
*/
4651
@Test
4752
public void testBigDouble() throws Exception {
48-
String content = "{\"customDouble\": 3.14159265358979323846}";
49-
System.out.printf("Input: %s\n", content);
50-
JSONParser parser = new JSONParser(DEFAULT_PERMISSIVE_MODE);
53+
String content = "{\"customDouble\":3.14159265358979323846}";
54+
// System.out.printf("Input: %s\n", content);
55+
JSONParser parser = new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE);
5156
JSONObject jwtContent = (JSONObject) parser.parse(content);
52-
System.out.printf("Output: %s\n", jwtContent.toJSONString());
57+
String serialized = jwtContent.toJSONString();
58+
// System.out.printf("Output: %s\n", serialized);
59+
assertEquals("should not loose precision", serialized, content);
5360
}
5461
}

json-smart/src/test/java/net/minidev/json/test/TestMisc.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ public void testIntOffset() throws Exception {
4545
public void testFloat() throws Exception {
4646
String s = "123.5";
4747
Object o = JSONValue.parseWithException(s);
48-
assertEquals(o, new Double(123.5));
48+
assertEquals(o, Double.valueOf(123.5));
4949
}
5050

5151
public void testFloat2() throws Exception {
5252
String s = "123.5E1";
5353
Object o = JSONValue.parseWithException(s);
54-
assertEquals(o, new Double(1235));
54+
assertEquals(o, Double.valueOf(1235));
5555
}
5656

5757
public void testFloat3() throws Exception {

json-smart/src/test/java/net/minidev/json/test/TestUtf8.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void testString() throws Exception {
1717
String s = "{\"key\":\"" + nonLatinText + "\"}";
1818
JSONObject obj = (JSONObject) JSONValue.parse(s);
1919
String v = (String) obj.get("key"); // result is incorrect
20-
System.out.println(v);
20+
// System.out.println(v);
2121
assertEquals(v, nonLatinText);
2222
}
2323
}
@@ -29,7 +29,7 @@ public void testReader() throws Exception {
2929
JSONObject obj = (JSONObject) JSONValue.parse(reader);
3030

3131
String v = (String) obj.get("key"); // result is incorrect
32-
System.out.println(v);
32+
// System.out.println(v);
3333
assertEquals(v, nonLatinText);
3434
}
3535
}
@@ -40,7 +40,7 @@ public void testInputStream() throws Exception {
4040
ByteArrayInputStream bis = new ByteArrayInputStream(s.getBytes("utf8"));
4141
JSONObject obj = (JSONObject) JSONValue.parse(bis);
4242
String v = (String) obj.get("key"); // result is incorrect
43-
System.out.println(v);
43+
// System.out.println(v);
4444
assertEquals(v, nonLatinText);
4545
}
4646
}
@@ -51,7 +51,7 @@ public void testBytes() throws Exception {
5151
byte[] bs = s.getBytes("utf8");
5252
JSONObject obj = (JSONObject) JSONValue.parse(bs);
5353
String v = (String) obj.get("key"); // result is incorrect
54-
System.out.println(v);
54+
// System.out.println(v);
5555
assertEquals(v, nonLatinText);
5656
}
5757
}

parent/pom.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,8 @@
148148
</reporting>
149149

150150
<modules>
151-
<!-- <module>../commons</module> -->
152-
<!-- <module>../conf</module> -->
153-
<!-- <module>../csv</module> -->
154-
<!-- <module>../db</module> -->
155-
<!-- <module>../html</module> -->
156151
<module>../json-smart</module>
157152
<!-- <module>../json-smart-mini</module> -->
158-
<!-- <module>../minibase</module> -->
159-
<!-- <module>../minibase-srv</module> -->
160-
<!-- <module>../minibase-gae</module> -->
161-
<!-- <module>../ovh</module> -->
162-
<!-- <module>../types</module> -->
163153
</modules>
164154

165155
<distributionManagement>
@@ -277,7 +267,7 @@
277267
<dependency>
278268
<groupId>junit</groupId>
279269
<artifactId>junit</artifactId>
280-
<version>[4.13.1,)</version>
270+
<version>[4.13.2,)</version>
281271
</dependency>
282272
</dependencies>
283273
</dependencyManagement>

0 commit comments

Comments
 (0)