The following issues were found
src/test/java/com/alibaba/json/bvt/parser/ReadOnlyAtomicBooleanTest.java
4 issues
Line: 13
public class ReadOnlyAtomicBooleanTest extends TestCase {
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(true);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":true}", text);
Reported by PMD.
Line: 15
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(true);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":true}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":true}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicBoolean value = new AtomicBoolean();
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":true}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicBoolean value = new AtomicBoolean();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/ReadOnlyAtomicIntegerTest.java
4 issues
Line: 13
public class ReadOnlyAtomicIntegerTest extends TestCase {
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(1001);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Reported by PMD.
Line: 15
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(1001);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicInteger value = new AtomicInteger();
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicInteger value = new AtomicInteger();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/ReadOnlyAtomicLongTest.java
4 issues
Line: 13
public class ReadOnlyAtomicLongTest extends TestCase {
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(1001);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Reported by PMD.
Line: 15
public void test_readOnly() throws Exception {
Model model = new Model();
model.value.set(1001);
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicLong value = new AtomicLong();
Reported by PMD.
Line: 20
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"value\":1001}", text);
Model model2 = JSON.parseObject(text, Model.class);
Assert.assertEquals(model.value.get(), model2.value.get());
}
public static class Model {
private final AtomicLong value = new AtomicLong();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/ReadOnlyMapTest_final_field.java
4 issues
Line: 14
public class ReadOnlyMapTest_final_field extends TestCase {
public void test_readOnlyNullList() throws Exception {
String text = "{\"values\":{\"a\":{}}}";
Entity entity = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity);
Assert.assertNotNull(entity.values.get("a"));
Assert.assertTrue(entity.values.get("a") instanceof A);
Reported by PMD.
Line: 18
String text = "{\"values\":{\"a\":{}}}";
Entity entity = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity);
Assert.assertNotNull(entity.values.get("a"));
Assert.assertTrue(entity.values.get("a") instanceof A);
}
public static class Entity {
Reported by PMD.
Line: 19
Entity entity = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity);
Assert.assertNotNull(entity.values.get("a"));
Assert.assertTrue(entity.values.get("a") instanceof A);
}
public static class Entity {
public final Map<String, A> values = new HashMap<String, A>();
Reported by PMD.
Line: 24
public static class Entity {
public final Map<String, A> values = new HashMap<String, A>();
}
public static class A {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/TestInitStringFieldAsEmpty.java
4 issues
Line: 11
public class TestInitStringFieldAsEmpty extends TestCase {
public void test_private() throws Exception {
VO1 vo1 = JSON.parseObject("{}", VO1.class, Feature.InitStringFieldAsEmpty);
Assert.assertEquals("", vo1.getValue());
}
public void test_public() throws Exception {
Reported by PMD.
Line: 13
public void test_private() throws Exception {
VO1 vo1 = JSON.parseObject("{}", VO1.class, Feature.InitStringFieldAsEmpty);
Assert.assertEquals("", vo1.getValue());
}
public void test_public() throws Exception {
VO2 vo2 = JSON.parseObject("{}", VO2.class, Feature.InitStringFieldAsEmpty);
Assert.assertEquals("", vo2.getValue());
Reported by PMD.
Line: 16
Assert.assertEquals("", vo1.getValue());
}
public void test_public() throws Exception {
VO2 vo2 = JSON.parseObject("{}", VO2.class, Feature.InitStringFieldAsEmpty);
Assert.assertEquals("", vo2.getValue());
}
private static class VO1 {
Reported by PMD.
Line: 18
public void test_public() throws Exception {
VO2 vo2 = JSON.parseObject("{}", VO2.class, Feature.InitStringFieldAsEmpty);
Assert.assertEquals("", vo2.getValue());
}
private static class VO1 {
private String value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/fullSer/EmtpyLinkedHashMapTest.java
4 issues
Line: 10
import junit.framework.TestCase;
public class EmtpyLinkedHashMapTest extends TestCase {
public void test_0() throws Exception {
Map map = (Map) JSON.parseObject("{\"@type\":\"java.util.LinkedHashMap\"}", Object.class);
}
}
Reported by PMD.
Line: 10
import junit.framework.TestCase;
public class EmtpyLinkedHashMapTest extends TestCase {
public void test_0() throws Exception {
Map map = (Map) JSON.parseObject("{\"@type\":\"java.util.LinkedHashMap\"}", Object.class);
}
}
Reported by PMD.
Line: 11
public class EmtpyLinkedHashMapTest extends TestCase {
public void test_0() throws Exception {
Map map = (Map) JSON.parseObject("{\"@type\":\"java.util.LinkedHashMap\"}", Object.class);
}
}
Reported by PMD.
Line: 11
public class EmtpyLinkedHashMapTest extends TestCase {
public void test_0() throws Exception {
Map map = (Map) JSON.parseObject("{\"@type\":\"java.util.LinkedHashMap\"}", Object.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/feature/FeaturesTest7.java
4 issues
Line: 13
public class FeaturesTest7 extends TestCase {
public void test_0() throws Exception {
SerializeConfig config = new SerializeConfig();
config.setAsmEnable(false);
String text = JSON.toJSONString(new Entity(), config);
Assert.assertEquals("{\"value\":\"SECONDS\"}", text);
Reported by PMD.
Line: 21
Assert.assertEquals("{\"value\":\"SECONDS\"}", text);
}
public void test_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.setAsmEnable(true);
String text = JSON.toJSONString(new Entity(), config);
Assert.assertEquals("{\"value\":\"SECONDS\"}", text);
Reported by PMD.
Line: 31
public static class Entity {
private TimeUnit value = TimeUnit.SECONDS;
@JSONField(serialzeFeatures = { SerializerFeature.WriteEnumUsingToString })
public TimeUnit getValue() {
return value;
}
Reported by PMD.
Line: 31
public static class Entity {
private TimeUnit value = TimeUnit.SECONDS;
@JSONField(serialzeFeatures = { SerializerFeature.WriteEnumUsingToString })
public TimeUnit getValue() {
return value;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/TypeUtilsTest_castToBytes.java
4 issues
Line: 11
public class TypeUtilsTest_castToBytes extends TestCase {
public void test_castToDate() throws Exception {
Assert.assertArrayEquals(new byte[0], TypeUtils.castToBytes(new byte[0]));
}
public void test_castToDate_error() throws Exception {
Exception error = null;
Reported by PMD.
Line: 15
Assert.assertArrayEquals(new byte[0], TypeUtils.castToBytes(new byte[0]));
}
public void test_castToDate_error() throws Exception {
Exception error = null;
try {
TypeUtils.castToBytes(new int[0]);
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 19
Exception error = null;
try {
TypeUtils.castToBytes(new int[0]);
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
Reported by PMD.
Line: 16
}
public void test_castToDate_error() throws Exception {
Exception error = null;
try {
TypeUtils.castToBytes(new int[0]);
} catch (Exception ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/TypeUtilsTest_loadClass.java
4 issues
Line: 11
public class TypeUtilsTest_loadClass extends TestCase {
public void test_loadClass() throws Exception {
Assert.assertSame(Entity.class,
TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass$Entity",
Entity.class.getClassLoader()));
Assert.assertSame(Entity.class,
Reported by PMD.
Line: 14
public void test_loadClass() throws Exception {
Assert.assertSame(Entity.class,
TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass$Entity",
Entity.class.getClassLoader()));
Assert.assertSame(Entity.class,
TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass$Entity", null));
}
Reported by PMD.
Line: 20
TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass$Entity", null));
}
public void test_error() throws Exception {
Assert.assertNull(TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass.Entity",
Entity.class.getClassLoader()));
}
public static class Entity {
Reported by PMD.
Line: 22
public void test_error() throws Exception {
Assert.assertNull(TypeUtils.loadClass("com.alibaba.json.bvt.parser.TypeUtilsTest_loadClass.Entity",
Entity.class.getClassLoader()));
}
public static class Entity {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/UTF8ByteArrayLexerTest_symbol.java
4 issues
Line: 10
public class UTF8ByteArrayLexerTest_symbol extends TestCase {
public void test_utf8() throws Exception {
byte[] bytes = "{\"name\":\"温家宝\", \"name\":\"xx\"}".getBytes("UTF-8");
JSONObject json = JSON.parseObject(bytes, JSONObject.class);
}
}
Reported by PMD.
Line: 10
public class UTF8ByteArrayLexerTest_symbol extends TestCase {
public void test_utf8() throws Exception {
byte[] bytes = "{\"name\":\"温家宝\", \"name\":\"xx\"}".getBytes("UTF-8");
JSONObject json = JSON.parseObject(bytes, JSONObject.class);
}
}
Reported by PMD.
Line: 13
public void test_utf8() throws Exception {
byte[] bytes = "{\"name\":\"温家宝\", \"name\":\"xx\"}".getBytes("UTF-8");
JSONObject json = JSON.parseObject(bytes, JSONObject.class);
}
}
Reported by PMD.
Line: 13
public void test_utf8() throws Exception {
byte[] bytes = "{\"name\":\"温家宝\", \"name\":\"xx\"}".getBytes("UTF-8");
JSONObject json = JSON.parseObject(bytes, JSONObject.class);
}
}
Reported by PMD.