MCPcopy Create free account
hub / github.com/e2wugui/zeze / testSerialize

Method testSerialize

ZezeJava/ZezeJavaTest/src/Temp/TestBigInt.java:17–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 private static final Logger logger = LogManager.getLogger(TestBigInt.class);
16
17 public void testSerialize() {
18 var id128 = new Id128(123, 0x1234_5678_90ab_cdefL);
19 var bb = ByteBuffer.Allocate();
20 id128.encode(bb);
21
22 var gb = new GenericBean();
23 gb.decode(bb);
24 assertEquals(1, gb.fields.size()); // field count
25 var e = gb.fields.entrySet().iterator().next();
26 assertEquals(1, e.getKey().intValue()); // varId
27 assertEquals(ArrayList.class, e.getValue().getClass());
28 var list = (ArrayList<?>)e.getValue();
29 assertEquals(2, list.size());
30 var high = list.get(0);
31 var low = list.get(1);
32 assertEquals(Integer.class, high.getClass());
33 assertEquals(Long.class, low.getClass());
34 assertEquals(id128.getHigh(), ((Integer)high).intValue());
35 assertEquals(id128.getLow(), ((Long)low).longValue());
36 }
37
38 public void testOrder() {
39 var rand = ThreadLocalRandom.current();

Callers

nothing calls this directly

Calls 14

AllocateMethod · 0.95
encodeMethod · 0.95
decodeMethod · 0.95
getHighMethod · 0.95
getLowMethod · 0.95
sizeMethod · 0.65
nextMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65
getMethod · 0.65
iteratorMethod · 0.45
entrySetMethod · 0.45

Tested by

no test coverage detected