@@ -239,6 +239,39 @@ public void getRequiredAnnotationThrowsException() {
239
239
assertThatThrownBy (() -> property .getRequiredAnnotation (Transient .class )).isInstanceOf (IllegalStateException .class );
240
240
}
241
241
242
+ @ Test // DATACMNS-1359
243
+ public void missingRequiredGetterThrowsException () {
244
+
245
+ SamplePersistentProperty property = getProperty (Sample .class , "field" );
246
+
247
+ assertThatExceptionOfType (IllegalArgumentException .class ) //
248
+ .isThrownBy (() -> property .getRequiredGetter ()) //
249
+ .withMessageContaining ("field" ) //
250
+ .withMessageContaining (Sample .class .getName ());
251
+ }
252
+
253
+ @ Test // DATACMNS-1359
254
+ public void missingRequiredSetterThrowsException () {
255
+
256
+ SamplePersistentProperty property = getProperty (Sample .class , "field" );
257
+
258
+ assertThatExceptionOfType (IllegalArgumentException .class ) //
259
+ .isThrownBy (() -> property .getRequiredSetter ()) //
260
+ .withMessageContaining ("field" ) //
261
+ .withMessageContaining (Sample .class .getName ());
262
+ }
263
+
264
+ @ Test
265
+ public void missingRequiredFieldThrowsException () {
266
+
267
+ SamplePersistentProperty property = getProperty (NoField .class , "firstname" );
268
+
269
+ assertThatExceptionOfType (IllegalArgumentException .class ) //
270
+ .isThrownBy (() -> property .getRequiredField ()) //
271
+ .withMessageContaining ("firstname" ) //
272
+ .withMessageContaining (NoField .class .getName ());
273
+ }
274
+
242
275
@ SuppressWarnings ("unchecked" )
243
276
private Map <Class <? extends Annotation >, Annotation > getAnnotationCache (SamplePersistentProperty property ) {
244
277
return (Map <Class <? extends Annotation >, Annotation >) ReflectionTestUtils .getField (property , "annotationCache" );
@@ -410,4 +443,9 @@ public String getField() {
410
443
@interface CustomReadOnly {
411
444
412
445
}
446
+
447
+ interface NoField {
448
+
449
+ String getFirstname ();
450
+ }
413
451
}
0 commit comments