35
35
* @author Mark Paluch
36
36
* @author Christoph Strobl
37
37
*/
38
- public class PreferredConstructorDiscovererUnitTests <P extends PersistentProperty <P >> {
38
+ class PreferredConstructorDiscovererUnitTests <P extends PersistentProperty <P >> {
39
39
40
40
@ Test // DATACMNS-1126
41
- public void findsNoArgConstructorForClassWithoutExplicitConstructor () {
41
+ void findsNoArgConstructorForClassWithoutExplicitConstructor () {
42
42
43
43
assertThat (PreferredConstructorDiscoverer .discover (EntityWithoutConstructor .class )).satisfies (constructor -> {
44
44
@@ -49,7 +49,7 @@ public void findsNoArgConstructorForClassWithoutExplicitConstructor() {
49
49
}
50
50
51
51
@ Test // DATACMNS-1126
52
- public void findsNoArgConstructorForClassWithMultipleConstructorsAndNoArgOne () {
52
+ void findsNoArgConstructorForClassWithMultipleConstructorsAndNoArgOne () {
53
53
54
54
assertThat (PreferredConstructorDiscoverer .discover (ClassWithEmptyConstructor .class )).satisfies (constructor -> {
55
55
@@ -60,35 +60,34 @@ public void findsNoArgConstructorForClassWithMultipleConstructorsAndNoArgOne() {
60
60
}
61
61
62
62
@ Test // DATACMNS-1126
63
- public void doesNotThrowExceptionForMultipleConstructorsAndNoNoArgConstructorWithoutAnnotation () {
63
+ void doesNotThrowExceptionForMultipleConstructorsAndNoNoArgConstructorWithoutAnnotation () {
64
64
65
65
assertThat (PreferredConstructorDiscoverer .discover (ClassWithMultipleConstructorsWithoutEmptyOne .class )).isNull ();
66
66
}
67
67
68
68
@ Test // DATACMNS-1126
69
69
@ SuppressWarnings ({ "unchecked" , "rawtypes" })
70
- public void usesConstructorWithAnnotationOverEveryOther () {
71
-
70
+ void usesConstructorWithAnnotationOverEveryOther () {
72
71
73
72
assertThat (PreferredConstructorDiscoverer .discover (ClassWithMultipleConstructorsAndAnnotation .class ))
74
73
.satisfies (constructor -> {
75
74
76
- assertThat (constructor ).isNotNull ();
77
- assertThat (constructor .isNoArgConstructor ()).isFalse ();
78
- assertThat (constructor .isExplicitlyAnnotated ()).isTrue ();
75
+ assertThat (constructor ).isNotNull ();
76
+ assertThat (constructor .isNoArgConstructor ()).isFalse ();
77
+ assertThat (constructor .isExplicitlyAnnotated ()).isTrue ();
79
78
80
- assertThat (constructor .hasParameters ()).isTrue ();
79
+ assertThat (constructor .hasParameters ()).isTrue ();
81
80
82
81
Iterator <Parameter <Object , P >> parameters = (Iterator ) constructor .getParameters ().iterator ();
83
82
84
- Parameter <?, P > parameter = parameters .next ();
85
- assertThat (parameter .getType ().getType ()).isEqualTo (Long .class );
86
- assertThat (parameters .hasNext ()).isFalse ();
87
- });
83
+ Parameter <?, P > parameter = parameters .next ();
84
+ assertThat (parameter .getType ().getType ()).isEqualTo (Long .class );
85
+ assertThat (parameters .hasNext ()).isFalse ();
86
+ });
88
87
}
89
88
90
89
@ Test // DATACMNS-134, DATACMNS-1126
91
- public void discoversInnerClassConstructorCorrectly () {
90
+ void discoversInnerClassConstructorCorrectly () {
92
91
93
92
PersistentEntity <Inner , P > entity = new BasicPersistentEntity <>(ClassTypeInformation .from (Inner .class ));
94
93
@@ -100,7 +99,7 @@ public void discoversInnerClassConstructorCorrectly() {
100
99
}
101
100
102
101
@ Test // DATACMNS-1082, DATACMNS-1126
103
- public void skipsSyntheticConstructor () {
102
+ void skipsSyntheticConstructor () {
104
103
105
104
PersistentEntity <SyntheticConstructor , P > entity = new BasicPersistentEntity <>(
106
105
ClassTypeInformation .from (SyntheticConstructor .class ));
@@ -116,13 +115,12 @@ public void skipsSyntheticConstructor() {
116
115
@ Test // GH-2313
117
116
void capturesEnclosingTypeParameterOfNonStaticInnerClass () {
118
117
119
- assertThat (PreferredConstructorDiscoverer .discover (NonStaticWithGenericTypeArgUsedInCtor .class ))
120
- .satisfies (ctor -> {
118
+ assertThat (PreferredConstructorDiscoverer .discover (NonStaticWithGenericTypeArgUsedInCtor .class )).satisfies (ctor -> {
121
119
122
- assertThat (ctor .getParameters ()).hasSize (2 );
123
- assertThat (ctor .getParameters ().get (0 ).getName ()).isEqualTo ("this$0" );
124
- assertThat (ctor .getParameters ().get (1 ).getName ()).isEqualTo ("value" );
125
- });
120
+ assertThat (ctor .getParameters ()).hasSize (2 );
121
+ assertThat (ctor .getParameters ().get (0 ).getName ()).isEqualTo ("this$0" );
122
+ assertThat (ctor .getParameters ().get (1 ).getName ()).isEqualTo ("value" );
123
+ });
126
124
}
127
125
128
126
@ Test // GH-2313
@@ -150,7 +148,7 @@ class InnerSynthetic {
150
148
}
151
149
}
152
150
153
- static class EntityWithoutConstructor {
151
+ private static class EntityWithoutConstructor {
154
152
155
153
}
156
154
@@ -192,10 +190,9 @@ class Inner {
192
190
193
191
static class GenericTypeArgUsedInCtor <T > {
194
192
195
- protected GenericTypeArgUsedInCtor (T value ) {}
193
+ GenericTypeArgUsedInCtor (T value ) {}
196
194
}
197
195
198
-
199
196
class NonStaticWithGenericTypeArgUsedInCtor <T > {
200
197
201
198
protected NonStaticWithGenericTypeArgUsedInCtor (T value ) {}
0 commit comments