57
57
import io .vavr .Tuple2 ;
58
58
import org .junit .jupiter .api .Test ;
59
59
60
- public class AspectModelJacksonModuleTest {
60
+ class AspectModelJacksonModuleTest {
61
61
private static final String PACKAGE = "org.eclipse.esmf.test" ;
62
62
63
63
@ Test
64
- public void testAspectWithMultiLanguageText () throws Exception {
64
+ void testAspectWithMultiLanguageText () throws Exception {
65
65
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_MULTI_LANGUAGE_TEXT );
66
66
final Class <?> clazz = instance .getClass ();
67
67
final LangString prop = getValue ( clazz , instance , "prop" , LangString .class );
@@ -70,7 +70,7 @@ public void testAspectWithMultiLanguageText() throws Exception {
70
70
}
71
71
72
72
@ Test
73
- public void testAspectWithSimpleTypes () throws Exception {
73
+ void testAspectWithSimpleTypes () throws Exception {
74
74
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_SIMPLE_TYPES );
75
75
final Class <?> clazz = instance .getClass ();
76
76
@@ -93,7 +93,7 @@ public void testAspectWithSimpleTypes() throws Exception {
93
93
}
94
94
95
95
@ Test
96
- public void testAspectWithCollection () throws Exception {
96
+ void testAspectWithCollection () throws Exception {
97
97
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_COLLECTIONS );
98
98
final Class <?> clazz = instance .getClass ();
99
99
@@ -109,7 +109,7 @@ public void testAspectWithCollection() throws Exception {
109
109
}
110
110
111
111
@ Test
112
- public void testAspectWithEntity () throws Exception {
112
+ void testAspectWithEntity () throws Exception {
113
113
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_SIMPLE_ENTITY );
114
114
final Class <?> clazz = instance .getClass ();
115
115
@@ -123,7 +123,7 @@ public void testAspectWithEntity() throws Exception {
123
123
}
124
124
125
125
@ Test
126
- public void testAspectWithOptionalProperties () throws Exception {
126
+ void testAspectWithOptionalProperties () throws Exception {
127
127
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_OPTIONAL_PROPERTIES );
128
128
final Class <?> clazz = instance .getClass ();
129
129
@@ -137,7 +137,7 @@ public void testAspectWithOptionalProperties() throws Exception {
137
137
}
138
138
139
139
@ Test
140
- public void testAspectWithStructuredValue () throws Exception {
140
+ void testAspectWithStructuredValue () throws Exception {
141
141
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_NUMERIC_STRUCTURED_VALUE );
142
142
final Class <?> clazz = instance .getClass ();
143
143
@@ -146,18 +146,21 @@ public void testAspectWithStructuredValue() throws Exception {
146
146
assertThat ( date .getMonth () ).isEqualTo ( 1 );
147
147
assertThat ( date .getDay () ).isEqualTo ( 20 );
148
148
149
- final Long year = getValue ( clazz , instance , "year" , Long .class );
150
- assertThat ( year ).isEqualTo ( 2020L );
149
+ final Optional <Long > yearOptional = getValue ( clazz , instance , "year" , Optional .class );
150
+ assertThat ( yearOptional ).isPresent ();
151
+ assertThat ( yearOptional .get () ).isEqualTo ( 2020L );
151
152
152
- final Long month = getValue ( clazz , instance , "month" , Long .class );
153
- assertThat ( month ).isEqualTo ( 1 );
153
+ final Optional <Long > monthOptional = getValue ( clazz , instance , "month" , Optional .class );
154
+ assertThat ( monthOptional ).isPresent ();
155
+ assertThat ( monthOptional .get () ).isEqualTo ( 1L );
154
156
155
- final Long day = getValue ( clazz , instance , "day" , Long .class );
156
- assertThat ( day ).isEqualTo ( 20 );
157
+ final Optional <Long > dayOptional = getValue ( clazz , instance , "day" , Optional .class );
158
+ assertThat ( dayOptional ).isPresent ();
159
+ assertThat ( dayOptional .get () ).isEqualTo ( 20L );
157
160
}
158
161
159
162
@ Test
160
- public void testAspectWithEnumeration () throws Exception {
163
+ void testAspectWithEnumeration () throws Exception {
161
164
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_STRING_ENUMERATION );
162
165
final Class <?> clazz = instance .getClass ();
163
166
@@ -172,7 +175,7 @@ public void testAspectWithEnumeration() throws Exception {
172
175
}
173
176
174
177
@ Test
175
- public void testAspectWithEntityEnumeration () throws Exception {
178
+ void testAspectWithEntityEnumeration () throws Exception {
176
179
final Object instance = generateInstance (
177
180
Tuple .of ( TestAspect .ASPECT_WITH_ENTITY_ENUMERATION_WITH_NOT_EXISTING_ENUM , "AspectWithEntityEnumeration" ) );
178
181
final Class <?> clazz = instance .getClass ();
@@ -191,14 +194,14 @@ public void testAspectWithEntityEnumeration() throws Exception {
191
194
}
192
195
193
196
@ Test
194
- public void testAspectWithEntityEnumerationWithNotExistingEnum () {
197
+ void testAspectWithEntityEnumerationWithNotExistingEnum () {
195
198
assertThatExceptionOfType ( EnumAttributeNotFoundException .class ).isThrownBy ( () ->
196
199
generateInstance ( TestAspect .ASPECT_WITH_ENTITY_ENUMERATION_WITH_NOT_EXISTING_ENUM ) )
197
200
.withMessageContainingAll ( "Tried to parse value" , "but there is no enum field like that" );
198
201
}
199
202
200
203
@ Test
201
- public void testAspectWithEntityEnumerationAndNotInPayloadProperties () throws Exception {
204
+ void testAspectWithEntityEnumerationAndNotInPayloadProperties () throws Exception {
202
205
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_ENTITY_ENUMERATION_AND_NOT_IN_PAYLOAD_PROPERTIES );
203
206
final Class <?> clazz = instance .getClass ();
204
207
final Field enumerationField = clazz .getDeclaredField ( "systemState" );
@@ -216,7 +219,7 @@ public void testAspectWithEntityEnumerationAndNotInPayloadProperties() throws Ex
216
219
}
217
220
218
221
@ Test
219
- public void testAspectWithEitherWithComplexTypes () throws Exception {
222
+ void testAspectWithEitherWithComplexTypes () throws Exception {
220
223
final Object instance = generateInstance ( TestAspect .ASPECT_WITH_EITHER_WITH_COMPLEX_TYPES );
221
224
final Class <?> clazz = instance .getClass ();
222
225
final Field testProperty = clazz .getDeclaredField ( "testProperty" );
0 commit comments