File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
src/test/java/com/flowingcode/addons/applayout/test Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 110110 <version >1.3</version >
111111 <scope >test</scope >
112112 </dependency >
113+ <dependency >
114+ <groupId >javax.servlet</groupId >
115+ <artifactId >javax.servlet-api</artifactId >
116+ <version >3.1.0</version >
117+ <scope >provided</scope >
118+ </dependency >
113119 </dependencies >
114120
115121 <build >
Original file line number Diff line number Diff line change 1+ package com .flowingcode .addons .applayout .test ;
2+
3+ import java .io .ByteArrayInputStream ;
4+ import java .io .ByteArrayOutputStream ;
5+ import java .io .IOException ;
6+ import java .io .ObjectInputStream ;
7+ import java .io .ObjectOutputStream ;
8+
9+ import org .junit .Test ;
10+
11+ import com .flowingcode .addons .applayout .AppLayout ;
12+ import com .flowingcode .addons .applayout .MenuItem ;
13+
14+ public class SerializationTest {
15+
16+ private void testSerializationOf (Object obj ) throws IOException , ClassNotFoundException {
17+ ByteArrayOutputStream baos = new ByteArrayOutputStream ();
18+ try (ObjectOutputStream oos = new ObjectOutputStream (baos )) {
19+ oos .writeObject (obj );
20+ }
21+ try (ObjectInputStream in = new ObjectInputStream (new ByteArrayInputStream (baos .toByteArray ()))) {
22+ obj .getClass ().cast (in .readObject ());
23+ }
24+ }
25+
26+ @ Test
27+ public void testSerialization () throws ClassNotFoundException , IOException {
28+ AppLayout appLayout = new AppLayout ("" );
29+ appLayout .setMenuItems (new MenuItem ("Item" , () -> {}));
30+ testSerializationOf (appLayout );
31+ }
32+
33+ }
You can’t perform that action at this time.
0 commit comments