1
1
package com .sap .cloud .sdk .datamodel .openapi .sample .api ;
2
2
3
+ import static org .assertj .core .api .Assertions .assertThat ;
4
+
5
+ import org .junit .jupiter .api .Test ;
6
+
3
7
import com .fasterxml .jackson .databind .ObjectMapper ;
8
+ import com .sap .cloud .sdk .datamodel .openapi .sample .model .EmbeddingInputText ;
4
9
import com .sap .cloud .sdk .datamodel .openapi .sample .model .EmbeddingsInputTextById1D ;
5
10
import com .sap .cloud .sdk .datamodel .openapi .sample .model .EmbeddingsInputTextById2D ;
6
- import com .sap .cloud .sdk .datamodel .openapi .sample .model .OneOfWithMultipleArrays ;
7
- import org .junit .jupiter .api .Test ;
8
11
9
- import static org .assertj .core .api .Assertions .assertThat ;
10
-
11
- class OneOfMultipleArrayDeserializationTest {
12
+ class OneOfMultipleArrayDeserializationTest
13
+ {
12
14
private ObjectMapper objectMapper = new ObjectMapper ();
13
15
private static final String JSON_ARRAY_INTEGERS = """
14
16
{
@@ -24,59 +26,58 @@ class OneOfMultipleArrayDeserializationTest {
24
26
private static final String JSON_ARRAY_OF_STRINGS = """
25
27
["test1", "test2"]
26
28
""" ;
27
-
29
+
28
30
@ Test
29
31
public void testDeserializeArrayOfIntegers ()
30
- throws Exception {
31
-
32
- final OneOfWithMultipleArrays result = objectMapper . readValue (
33
- JSON_ARRAY_INTEGERS , OneOfWithMultipleArrays .class );
34
-
32
+ throws Exception
33
+ {
34
+
35
+ final EmbeddingInputText result = objectMapper . readValue ( JSON_ARRAY_INTEGERS , EmbeddingInputText .class );
36
+
35
37
assertThat (result ).isNotNull ();
36
- assertThat (result ).isInstanceOf (OneOfWithMultipleArrays .InnerEmbeddingsInputTextById .class );
37
- final var inner = (OneOfWithMultipleArrays .InnerEmbeddingsInputTextById ) result ;
38
+ assertThat (result ).isInstanceOf (EmbeddingInputText .InnerEmbeddingsInputTextById .class );
39
+ final var inner = (EmbeddingInputText .InnerEmbeddingsInputTextById ) result ;
38
40
assertThat (inner .value ()).isInstanceOf (EmbeddingsInputTextById1D .class );
39
41
}
40
-
42
+
41
43
@ Test
42
44
public void testDeserializeArrayOfIntegers2D ()
43
- throws Exception {
44
-
45
- final OneOfWithMultipleArrays result = objectMapper . readValue (
46
- JSON_ARRAY_OF_INTEGERS_2D , OneOfWithMultipleArrays .class );
45
+ throws Exception
46
+ {
47
+
48
+ final EmbeddingInputText result = objectMapper . readValue ( JSON_ARRAY_OF_INTEGERS_2D , EmbeddingInputText .class );
47
49
assertThat (result ).isNotNull ();
48
- assertThat (result ).isInstanceOf (OneOfWithMultipleArrays .InnerEmbeddingsInputTextById .class );
49
- final var inner = (OneOfWithMultipleArrays .InnerEmbeddingsInputTextById ) result ;
50
+ assertThat (result ).isInstanceOf (EmbeddingInputText .InnerEmbeddingsInputTextById .class );
51
+ final var inner = (EmbeddingInputText .InnerEmbeddingsInputTextById ) result ;
50
52
assertThat (inner .value ()).isInstanceOf (EmbeddingsInputTextById2D .class );
51
53
}
52
-
54
+
53
55
@ Test
54
56
public void testDeserializeString ()
55
- throws Exception {
56
-
57
- final OneOfWithMultipleArrays result = objectMapper . readValue (
58
- JSON_STRING , OneOfWithMultipleArrays .class );
59
-
57
+ throws Exception
58
+ {
59
+
60
+ final EmbeddingInputText result = objectMapper . readValue ( JSON_STRING , EmbeddingInputText .class );
61
+
60
62
assertThat (result ).isNotNull ();
61
- assertThat (result ).isInstanceOf (OneOfWithMultipleArrays .InnerString .class );
62
- final var inner = (OneOfWithMultipleArrays .InnerString ) result ;
63
+ assertThat (result ).isInstanceOf (EmbeddingInputText .InnerString .class );
64
+ final var inner = (EmbeddingInputText .InnerString ) result ;
63
65
assertThat (inner .value ()).isInstanceOf (String .class );
64
66
}
65
-
67
+
66
68
@ Test
67
69
public void testDeserializeArrayOfStrings ()
68
- throws Exception {
69
-
70
- final OneOfWithMultipleArrays result = objectMapper . readValue (
71
- JSON_ARRAY_OF_STRINGS , OneOfWithMultipleArrays .class );
72
-
70
+ throws Exception
71
+ {
72
+
73
+ final EmbeddingInputText result = objectMapper . readValue ( JSON_ARRAY_OF_STRINGS , EmbeddingInputText .class );
74
+
73
75
assertThat (result ).isNotNull ();
74
- assertThat (result ).isInstanceOf (OneOfWithMultipleArrays .InnerStrings .class );
75
- final var inner = (OneOfWithMultipleArrays .InnerStrings ) result ;
76
+ assertThat (result ).isInstanceOf (EmbeddingInputText .InnerStrings .class );
77
+ final var inner = (EmbeddingInputText .InnerStrings ) result ;
76
78
assertThat (inner .values ()).isInstanceOf (java .util .List .class );
77
79
assertThat (inner .values ()).hasSize (2 );
78
80
assertThat (inner .values ().get (0 )).isEqualTo ("test1" );
79
81
assertThat (inner .values ().get (1 )).isEqualTo ("test2" );
80
82
}
81
-
82
83
}
0 commit comments