Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Apr 4, 2021
1 parent d692c7e commit b4068b3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.List;
import java.util.Map;

import net.minidev.json.parser.ContainerFactory;
import net.minidev.json.parser.ParseException;


import static net.minidev.json.parser.ParseException.*;
import static net.minidev.json.parser.JSONParser.*;

Expand Down
1 change: 0 additions & 1 deletion json-smart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<artifactId>json-smart</artifactId>
<packaging>bundle</packaging>
<version>1.3.2</version>

<parent>
<groupId>net.minidev</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void setPlugin(boolean plugin) {
public void testIssue26() {
App dbApp = new App();
dbApp.setSoftname("sssssssssss");
System.out.println();
assertTrue(JSONValue.toJSONString(dbApp).contains("sssssssssss"));
}

Expand Down
15 changes: 11 additions & 4 deletions json-smart/src/test/java/net/minidev/json/test/TestBigValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import java.math.BigInteger;
import java.util.HashMap;

import org.junit.Test;

import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue;
import net.minidev.json.parser.JSONParser;
import junit.framework.TestCase;

public class TestBigValue extends TestCase {
Expand All @@ -14,6 +17,7 @@ public class TestBigValue extends TestCase {
/**
* test BigDecimal serialization
*/
@Test
public void testBigDecimal() {
HashMap<String, Object> map = new HashMap<String, Object>();
BigDecimal bigDec = new BigDecimal(bigStr + "." + bigStr);
Expand All @@ -29,6 +33,7 @@ public void testBigDecimal() {
/**
* test BigInteger serialization
*/
@Test
public void testBigInteger() {
HashMap<String, Object> map = new HashMap<String, Object>();
BigInteger bigInt = new BigInteger(bigStr);
Expand All @@ -45,10 +50,12 @@ public void testBigInteger() {
*/
@Test
public void testBigDouble() throws Exception {
String content = "{\"customDouble\": 3.14159265358979323846}";
System.out.printf("Input: %s\n", content);
JSONParser parser = new JSONParser(DEFAULT_PERMISSIVE_MODE);
String content = "{\"customDouble\":3.14159265358979323846}";
// System.out.printf("Input: %s\n", content);
JSONParser parser = new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE);
JSONObject jwtContent = (JSONObject) parser.parse(content);
System.out.printf("Output: %s\n", jwtContent.toJSONString());
String serialized = jwtContent.toJSONString();
// System.out.printf("Output: %s\n", serialized);
assertEquals("should not loose precision", serialized, content);
}
}
4 changes: 2 additions & 2 deletions json-smart/src/test/java/net/minidev/json/test/TestMisc.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public void testIntOffset() throws Exception {
public void testFloat() throws Exception {
String s = "123.5";
Object o = JSONValue.parseWithException(s);
assertEquals(o, new Double(123.5));
assertEquals(o, Double.valueOf(123.5));
}

public void testFloat2() throws Exception {
String s = "123.5E1";
Object o = JSONValue.parseWithException(s);
assertEquals(o, new Double(1235));
assertEquals(o, Double.valueOf(1235));
}

public void testFloat3() throws Exception {
Expand Down
8 changes: 4 additions & 4 deletions json-smart/src/test/java/net/minidev/json/test/TestUtf8.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void testString() throws Exception {
String s = "{\"key\":\"" + nonLatinText + "\"}";
JSONObject obj = (JSONObject) JSONValue.parse(s);
String v = (String) obj.get("key"); // result is incorrect
System.out.println(v);
// System.out.println(v);
assertEquals(v, nonLatinText);
}
}
Expand All @@ -29,7 +29,7 @@ public void testReader() throws Exception {
JSONObject obj = (JSONObject) JSONValue.parse(reader);

String v = (String) obj.get("key"); // result is incorrect
System.out.println(v);
// System.out.println(v);
assertEquals(v, nonLatinText);
}
}
Expand All @@ -40,7 +40,7 @@ public void testInputStream() throws Exception {
ByteArrayInputStream bis = new ByteArrayInputStream(s.getBytes("utf8"));
JSONObject obj = (JSONObject) JSONValue.parse(bis);
String v = (String) obj.get("key"); // result is incorrect
System.out.println(v);
// System.out.println(v);
assertEquals(v, nonLatinText);
}
}
Expand All @@ -51,7 +51,7 @@ public void testBytes() throws Exception {
byte[] bs = s.getBytes("utf8");
JSONObject obj = (JSONObject) JSONValue.parse(bs);
String v = (String) obj.get("key"); // result is incorrect
System.out.println(v);
// System.out.println(v);
assertEquals(v, nonLatinText);
}
}
Expand Down
12 changes: 1 addition & 11 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,8 @@
</reporting>

<modules>
<!-- <module>../commons</module> -->
<!-- <module>../conf</module> -->
<!-- <module>../csv</module> -->
<!-- <module>../db</module> -->
<!-- <module>../html</module> -->
<module>../json-smart</module>
<!-- <module>../json-smart-mini</module> -->
<!-- <module>../minibase</module> -->
<!-- <module>../minibase-srv</module> -->
<!-- <module>../minibase-gae</module> -->
<!-- <module>../ovh</module> -->
<!-- <module>../types</module> -->
</modules>

<distributionManagement>
Expand Down Expand Up @@ -277,7 +267,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[4.13.1,)</version>
<version>[4.13.2,)</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down

0 comments on commit b4068b3

Please sign in to comment.