+
+ // test when event has no request ID
+ when(event.getRequestId()).thenReturn(null);
+ BeanValidationResult result = params.validate();
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("event").contains(REQUEST_ID_NAME).contains(NULL_MSG);
+
+ // try when context has no event
+ when(context.getEvent()).thenReturn(null);
+ result = params.validate();
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("event").doesNotContain(REQUEST_ID_NAME).contains(NULL_MSG);
+
+ // has both request ID and context, but no event
+ result = params.toBuilder().requestId(REQ_ID2).build().validate();
+ assertTrue(result.isValid());
+
+ // has request ID, but not context
+ result = params.toBuilder().requestId(REQ_ID2).context(null).build().validate();
+ assertTrue(result.isValid());