Add test to serialize/deserialize records in the execution context
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -151,6 +151,17 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
compareContexts(m1, m2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerializeRecords() throws IOException {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("foo", new Person(1, "foo"));
|
||||
m1.put("bar", new Person(2, "bar"));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
compareContexts(m1, m2);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testNullSerialization() throws Exception {
|
||||
getSerializer().serialize(null, null);
|
||||
@@ -263,4 +274,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
|
||||
}
|
||||
|
||||
public static record Person(int id, String name) implements Serializable {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2021 the original author or authors.
|
||||
* Copyright 2008-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,8 @@ public class Jackson2ExecutionContextStringSerializerTests extends AbstractExecu
|
||||
|
||||
@Before
|
||||
public void onSetUp() throws Exception {
|
||||
Jackson2ExecutionContextStringSerializer serializerDeserializer = new Jackson2ExecutionContextStringSerializer();
|
||||
Jackson2ExecutionContextStringSerializer serializerDeserializer = new Jackson2ExecutionContextStringSerializer(
|
||||
AbstractExecutionContextSerializerTests.Person.class.getName());
|
||||
|
||||
serializer = serializerDeserializer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user