Skip to content

Commit 15efc62

Browse files
committed
Fix tests
1 parent dd00379 commit 15efc62

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

core/esmf-aspect-model-jackson/src/test/java/org/eclipse/esmf/aspectmodel/jackson/AspectModelJacksonModuleTest.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@
5757
import io.vavr.Tuple2;
5858
import org.junit.jupiter.api.Test;
5959

60-
public class AspectModelJacksonModuleTest {
60+
class AspectModelJacksonModuleTest {
6161
private static final String PACKAGE = "org.eclipse.esmf.test";
6262

6363
@Test
64-
public void testAspectWithMultiLanguageText() throws Exception {
64+
void testAspectWithMultiLanguageText() throws Exception {
6565
final Object instance = generateInstance( TestAspect.ASPECT_WITH_MULTI_LANGUAGE_TEXT );
6666
final Class<?> clazz = instance.getClass();
6767
final LangString prop = getValue( clazz, instance, "prop", LangString.class );
@@ -70,7 +70,7 @@ public void testAspectWithMultiLanguageText() throws Exception {
7070
}
7171

7272
@Test
73-
public void testAspectWithSimpleTypes() throws Exception {
73+
void testAspectWithSimpleTypes() throws Exception {
7474
final Object instance = generateInstance( TestAspect.ASPECT_WITH_SIMPLE_TYPES );
7575
final Class<?> clazz = instance.getClass();
7676

@@ -93,7 +93,7 @@ public void testAspectWithSimpleTypes() throws Exception {
9393
}
9494

9595
@Test
96-
public void testAspectWithCollection() throws Exception {
96+
void testAspectWithCollection() throws Exception {
9797
final Object instance = generateInstance( TestAspect.ASPECT_WITH_COLLECTIONS );
9898
final Class<?> clazz = instance.getClass();
9999

@@ -109,7 +109,7 @@ public void testAspectWithCollection() throws Exception {
109109
}
110110

111111
@Test
112-
public void testAspectWithEntity() throws Exception {
112+
void testAspectWithEntity() throws Exception {
113113
final Object instance = generateInstance( TestAspect.ASPECT_WITH_SIMPLE_ENTITY );
114114
final Class<?> clazz = instance.getClass();
115115

@@ -123,7 +123,7 @@ public void testAspectWithEntity() throws Exception {
123123
}
124124

125125
@Test
126-
public void testAspectWithOptionalProperties() throws Exception {
126+
void testAspectWithOptionalProperties() throws Exception {
127127
final Object instance = generateInstance( TestAspect.ASPECT_WITH_OPTIONAL_PROPERTIES );
128128
final Class<?> clazz = instance.getClass();
129129

@@ -137,7 +137,7 @@ public void testAspectWithOptionalProperties() throws Exception {
137137
}
138138

139139
@Test
140-
public void testAspectWithStructuredValue() throws Exception {
140+
void testAspectWithStructuredValue() throws Exception {
141141
final Object instance = generateInstance( TestAspect.ASPECT_WITH_NUMERIC_STRUCTURED_VALUE );
142142
final Class<?> clazz = instance.getClass();
143143

@@ -146,18 +146,21 @@ public void testAspectWithStructuredValue() throws Exception {
146146
assertThat( date.getMonth() ).isEqualTo( 1 );
147147
assertThat( date.getDay() ).isEqualTo( 20 );
148148

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 );
151152

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 );
154156

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 );
157160
}
158161

159162
@Test
160-
public void testAspectWithEnumeration() throws Exception {
163+
void testAspectWithEnumeration() throws Exception {
161164
final Object instance = generateInstance( TestAspect.ASPECT_WITH_STRING_ENUMERATION );
162165
final Class<?> clazz = instance.getClass();
163166

@@ -172,7 +175,7 @@ public void testAspectWithEnumeration() throws Exception {
172175
}
173176

174177
@Test
175-
public void testAspectWithEntityEnumeration() throws Exception {
178+
void testAspectWithEntityEnumeration() throws Exception {
176179
final Object instance = generateInstance(
177180
Tuple.of( TestAspect.ASPECT_WITH_ENTITY_ENUMERATION_WITH_NOT_EXISTING_ENUM, "AspectWithEntityEnumeration" ) );
178181
final Class<?> clazz = instance.getClass();
@@ -191,14 +194,14 @@ public void testAspectWithEntityEnumeration() throws Exception {
191194
}
192195

193196
@Test
194-
public void testAspectWithEntityEnumerationWithNotExistingEnum() {
197+
void testAspectWithEntityEnumerationWithNotExistingEnum() {
195198
assertThatExceptionOfType( EnumAttributeNotFoundException.class ).isThrownBy( () ->
196199
generateInstance( TestAspect.ASPECT_WITH_ENTITY_ENUMERATION_WITH_NOT_EXISTING_ENUM ) )
197200
.withMessageContainingAll( "Tried to parse value", "but there is no enum field like that" );
198201
}
199202

200203
@Test
201-
public void testAspectWithEntityEnumerationAndNotInPayloadProperties() throws Exception {
204+
void testAspectWithEntityEnumerationAndNotInPayloadProperties() throws Exception {
202205
final Object instance = generateInstance( TestAspect.ASPECT_WITH_ENTITY_ENUMERATION_AND_NOT_IN_PAYLOAD_PROPERTIES );
203206
final Class<?> clazz = instance.getClass();
204207
final Field enumerationField = clazz.getDeclaredField( "systemState" );
@@ -216,7 +219,7 @@ public void testAspectWithEntityEnumerationAndNotInPayloadProperties() throws Ex
216219
}
217220

218221
@Test
219-
public void testAspectWithEitherWithComplexTypes() throws Exception {
222+
void testAspectWithEitherWithComplexTypes() throws Exception {
220223
final Object instance = generateInstance( TestAspect.ASPECT_WITH_EITHER_WITH_COMPLEX_TYPES );
221224
final Class<?> clazz = instance.getClass();
222225
final Field testProperty = clazz.getDeclaredField( "testProperty" );

0 commit comments

Comments
 (0)