The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_11.java
1 issues
Line: 13
public class SerializeWriterTest_11 extends TestCase {
public void test_erro_0() throws Exception {
SerializeWriter out = new SerializeWriter();
out.write(true);
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
out.writeTo(byteOut, "UTF-8");
Assert.assertEquals("true", new String(byteOut.toByteArray()));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderTest_0.java
1 issues
Line: 14
import com.alibaba.fastjson.parser.Feature;
public class JSONReaderTest_0 extends TestCase {
public void test_read() throws Exception {
JSONReader reader = new JSONReader(new StringReader("{}"));
reader.config(Feature.AllowArbitraryCommas, true);
JSONObject object = (JSONObject) reader.readObject();
Assert.assertNotNull(object);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/support/springfox/JsonValueTest.java
1 issues
Line: 11
import springfox.documentation.spring.web.json.Json;
public class JsonValueTest extends TestCase {
public void test_0() throws Exception {
Json json = new Json("\"{\"id\":1001\"}");
String text = JSON.toJSONString(json);
Assert.assertEquals("\"{\"id\":1001\"}", text);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerialContextTest.java
1 issues
Line: 10
public class SerialContextTest extends TestCase {
public void test_context() throws Exception {
SerialContext root = new SerialContext(null, null, null, 0, 0);
SerialContext context = new SerialContext(root, null, "x", 0, 0);
Assert.assertEquals("x", context.fieldName);
Assert.assertEquals("$.x", context.toString());
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/URIDeserializerTest.java
1 issues
Line: 15
public class URIDeserializerTest extends TestCase {
public void test_null() throws Exception {
String input = "null";
DefaultJSONParser parser = new DefaultJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
MiscCodec deser = new MiscCodec();
Assert.assertEquals(JSONToken.LITERAL_STRING, deser.getFastMatchToken());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/PrettyFormatTest.java
1 issues
Line: 12
public class PrettyFormatTest extends TestCase {
public void test_0() throws Exception {
Assert.assertEquals(0, new JSONSerializer().getIndentCount());
Assert.assertEquals("[\n\t{},\n\t{}\n]", JSON.toJSONString(new Object[] { new Object(), new Object() }, SerializerFeature.PrettyFormat));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/PointSerializerTest.java
1 issues
Line: 14
public class PointSerializerTest extends TestCase {
public void test_null() throws Exception {
VO vo = new VO();
Assert.assertEquals("{\"value\":null}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/PascalNameFilterTest_1.java
1 issues
Line: 15
public class PascalNameFilterTest_1 extends TestCase {
public void test_0() throws Exception {
JSONSerializer serializer = new JSONSerializer();
serializer.getNameFilters().add(new PascalNameFilter());
Map<String, Object> vo = new LinkedHashMap<String, Object>();
vo.put("", 123);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ListTest.java
1 issues
Line: 14
public class ListTest extends TestCase {
public void test_null() throws Exception {
List list = new LinkedList();
list.add(23L);
list.add(45L);
Assert.assertEquals("[23L,45L]", JSON.toJSONString(list, SerializerFeature.WriteClassName));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ListSerializerTest2.java
1 issues
Line: 15
public class ListSerializerTest2 extends TestCase {
public void test_0() throws Exception {
SerializeWriter out = new SerializeWriter();
ListSerializer listSerializer = new ListSerializer();
Object[] array = new Object[] { 1, 2, 3L, 4L, 5, 6, "a" };
Reported by PMD.