File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
src/test/java/com/labelzoom/api Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ repositories {
17
17
}
18
18
19
19
dependencies {
20
+ testImplementation ' com.fasterxml.jackson.core:jackson-databind:2.16.0'
20
21
testImplementation platform(' org.junit:junit-bom:5.9.1' )
21
22
testImplementation ' org.junit.jupiter:junit-jupiter'
22
23
}
Original file line number Diff line number Diff line change
1
+ package com .labelzoom .api ;
2
+
3
+ import com .fasterxml .jackson .databind .ObjectMapper ;
4
+ import com .labelzoom .api .model .components .CLabel ;
5
+ import org .junit .jupiter .api .Disabled ;
6
+ import org .junit .jupiter .api .Test ;
7
+
8
+ import static org .junit .jupiter .api .Assertions .*;
9
+
10
+ /**
11
+ * TODO: This test was succeeding when I ran it, but since I don't think the ordering of fields can be guaranteed, I
12
+ * disabled the test so that it won't interrupt CI/CD. But this is something we should expand on in the future. The
13
+ * goal is to ensure that if a developer adds a new field to a component, that they also update the cloning / deep copy
14
+ * logic. May look to use reflection to randomize the data in each field of the component.
15
+ */
16
+ public class DeepCopyTests
17
+ {
18
+ final ObjectMapper objectMapper = new ObjectMapper ();
19
+
20
+ @ Test
21
+ @ Disabled
22
+ void testSimpleClone ()
23
+ {
24
+ final CLabel label = new CLabel ();
25
+ final CLabel clone = label .clone ();
26
+ final String labelSerialized = assertDoesNotThrow (() -> objectMapper .writeValueAsString (label ));
27
+ final String cloneSerialized = assertDoesNotThrow (() -> objectMapper .writeValueAsString (clone ));
28
+ assertEquals (labelSerialized , cloneSerialized );
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments