JsonObjectDecoderTest Class — netty Architecture
Architecture documentation for the JsonObjectDecoderTest class in JsonObjectDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38["JsonObjectDecoderTest"] c54c3ed9_71c1_2f60_3738_58c4f315f32b["JsonObjectDecoderTest.java"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|defined in| c54c3ed9_71c1_2f60_3738_58c4f315f32b 33d52e52_4484_53aa_cd52_7809661e9c52["testJsonObjectOverMultipleWrites()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 33d52e52_4484_53aa_cd52_7809661e9c52 b96b7e94_9c05_1940_3328_397899f459df["testMultipleJsonObjectsOverMultipleWrites()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| b96b7e94_9c05_1940_3328_397899f459df 9411229a_11c7_135f_2443_eae9876eecb8["testJsonArrayOverMultipleWrites()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 9411229a_11c7_135f_2443_eae9876eecb8 95d3ec62_d2da_547c_b5ab_80941ece6f27["testStreamJsonArrayOverMultipleWrites1()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 95d3ec62_d2da_547c_b5ab_80941ece6f27 531c4996_99e4_62ee_d791_7047ca0946bc["testStreamJsonArrayOverMultipleWrites2()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 531c4996_99e4_62ee_d791_7047ca0946bc 86529502_a060_c8c3_768e_45b36de5dfa4["testStreamJsonArrayOverMultipleWrites3()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 86529502_a060_c8c3_768e_45b36de5dfa4 f0f329cc_c62b_5d3f_9826_35cb94b3b87d["doTestStreamJsonArrayOverMultipleWrites()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| f0f329cc_c62b_5d3f_9826_35cb94b3b87d 603d5328_189b_ef06_abf7_828e6a9d2780["testSingleByteStream()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 603d5328_189b_ef06_abf7_828e6a9d2780 e98d37ed_6568_3c5e_beb3_4d2d707d283e["testBackslashInString1()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| e98d37ed_6568_3c5e_beb3_4d2d707d283e c3b4ad2d_a7ab_1751_210f_671d0dfdd8b0["testBackslashInString2()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| c3b4ad2d_a7ab_1751_210f_671d0dfdd8b0 10d6b740_50d7_8beb_4af1_475f6dd0e306["testBackslashInString3()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| 10d6b740_50d7_8beb_4af1_475f6dd0e306 a31ededd_6731_8269_025e_408ed1febeb9["testMultipleJsonObjectsInOneWrite()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| a31ededd_6731_8269_025e_408ed1febeb9 ace9be71_8104_90bb_0907_a8600ebe8312["testNonJsonContent1()"] 6e0a0e48_218c_0ee1_ac6e_2abf169a9f38 -->|method| ace9be71_8104_90bb_0907_a8600ebe8312
Relationship Graph
Source Code
codec-base/src/test/java/io/netty/handler/codec/json/JsonObjectDecoderTest.java lines 34–418
public class JsonObjectDecoderTest {
@Test
public void testJsonObjectOverMultipleWrites() {
EmbeddedChannel ch = new EmbeddedChannel(new JsonObjectDecoder());
String objectPart1 = "{ \"firstname\": \"John";
String objectPart2 = "\" ,\n \"surname\" :";
String objectPart3 = "\"Doe\", age:22 \n}";
// Test object
ch.writeInbound(Unpooled.copiedBuffer(" \n\n " + objectPart1, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(objectPart2, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(objectPart3 + " \n\n \n", CharsetUtil.UTF_8));
ByteBuf res = ch.readInbound();
assertEquals(objectPart1 + objectPart2 + objectPart3, res.toString(CharsetUtil.UTF_8));
res.release();
assertFalse(ch.finish());
}
@Test
public void testMultipleJsonObjectsOverMultipleWrites() {
EmbeddedChannel ch = new EmbeddedChannel(new JsonObjectDecoder());
String objectPart1 = "{\"name\":\"Jo";
String objectPart2 = "hn\"}{\"name\":\"John\"}{\"name\":\"Jo";
String objectPart3 = "hn\"}";
ch.writeInbound(Unpooled.copiedBuffer(objectPart1, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(objectPart2, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(objectPart3, CharsetUtil.UTF_8));
for (int i = 0; i < 3; i++) {
ByteBuf res = ch.readInbound();
assertEquals("{\"name\":\"John\"}", res.toString(CharsetUtil.UTF_8));
res.release();
}
assertFalse(ch.finish());
}
@Test
public void testJsonArrayOverMultipleWrites() {
EmbeddedChannel ch = new EmbeddedChannel(new JsonObjectDecoder());
String arrayPart1 = "[{\"test";
String arrayPart2 = "case\" : \"\\\"}]Escaped dou\\\"ble quotes \\\" in JSON str\\\"ing\"";
String arrayPart3 = " }\n\n , ";
String arrayPart4 = "{\"testcase\" : \"Streaming string me";
String arrayPart5 = "ssage\"} ]";
// Test array
ch.writeInbound(Unpooled.copiedBuffer(" " + arrayPart1, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(arrayPart2, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(arrayPart3, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(arrayPart4, CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer(arrayPart5 + " ", CharsetUtil.UTF_8));
ByteBuf res = ch.readInbound();
assertEquals(arrayPart1 + arrayPart2 + arrayPart3 + arrayPart4 + arrayPart5, res.toString(CharsetUtil.UTF_8));
res.release();
assertFalse(ch.finish());
}
@Test
public void testStreamJsonArrayOverMultipleWrites1() {
String[] array = new String[] {
" [{\"test",
"case\" : \"\\\"}]Escaped dou\\\"ble quotes \\\" in JSON str\\\"ing\"",
" }\n\n , ",
"{\"testcase\" : \"Streaming string me",
"ssage\"} ] "
};
String[] result = new String[] {
"{\"testcase\" : \"\\\"}]Escaped dou\\\"ble quotes \\\" in JSON str\\\"ing\" }",
"{\"testcase\" : \"Streaming string message\"}"
};
doTestStreamJsonArrayOverMultipleWrites(2, array, result);
}
Source
Frequently Asked Questions
What is the JsonObjectDecoderTest class?
JsonObjectDecoderTest is a class in the netty codebase, defined in codec-base/src/test/java/io/netty/handler/codec/json/JsonObjectDecoderTest.java.
Where is JsonObjectDecoderTest defined?
JsonObjectDecoderTest is defined in codec-base/src/test/java/io/netty/handler/codec/json/JsonObjectDecoderTest.java at line 34.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free