@Test void testUpdateWhenRequestParameterIsNull() { when(mockApiRequestData.getRequestParameters()).thenReturn(null); underTest.update(mockAuditEventBuilder, mockApiRequestData); verify(mockApiRequestDataBuilder, never()).setRequestParameters(any()); }
@Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData) { AuditProto.ApiRequestData.Builder apiRequestDataBuilder = builderProvider.getNewApiRequestDataBuilder() .setMutating(eventData.isMutating()); doIfTrue(eventData.getApiVersion(), StringUtils::isNotEmpty, apiRequestDataBuilder::setApiVersion); doIfTrue(eventData.getRequestParameters(), StringUtils::isNotEmpty, apiRequestDataBuilder::setRequestParameters); doIfTrue(eventData.getUserAgent(), StringUtils::isNotEmpty, apiRequestDataBuilder::setUserAgent); auditEventBuilder.setApiRequestData(apiRequestDataBuilder.build()); }
ApiRequestDataBuildUpdater implements AuditEventBuilderUpdater<ApiRequestData> { @Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData) { AuditProto.ApiRequestData.Builder apiRequestDataBuilder = builderProvider.getNewApiRequestDataBuilder() .setMutating(eventData.isMutating()); doIfTrue(eventData.getApiVersion(), StringUtils::isNotEmpty, apiRequestDataBuilder::setApiVersion); doIfTrue(eventData.getRequestParameters(), StringUtils::isNotEmpty, apiRequestDataBuilder::setRequestParameters); doIfTrue(eventData.getUserAgent(), StringUtils::isNotEmpty, apiRequestDataBuilder::setUserAgent); auditEventBuilder.setApiRequestData(apiRequestDataBuilder.build()); } }
ApiRequestDataBuildUpdater implements AuditEventBuilderUpdater<ApiRequestData> { @Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData) { AuditProto.ApiRequestData.Builder apiRequestDataBuilder = builderProvider.getNewApiRequestDataBuilder() .setMutating(eventData.isMutating()); doIfTrue(eventData.getApiVersion(), StringUtils::isNotEmpty, apiRequestDataBuilder::setApiVersion); doIfTrue(eventData.getRequestParameters(), StringUtils::isNotEmpty, apiRequestDataBuilder::setRequestParameters); doIfTrue(eventData.getUserAgent(), StringUtils::isNotEmpty, apiRequestDataBuilder::setUserAgent); auditEventBuilder.setApiRequestData(apiRequestDataBuilder.build()); } ApiRequestDataBuildUpdater(ApiRequestDataBuilderProvider builderProvider); }
ApiRequestDataBuildUpdater implements AuditEventBuilderUpdater<ApiRequestData> { @Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData) { AuditProto.ApiRequestData.Builder apiRequestDataBuilder = builderProvider.getNewApiRequestDataBuilder() .setMutating(eventData.isMutating()); doIfTrue(eventData.getApiVersion(), StringUtils::isNotEmpty, apiRequestDataBuilder::setApiVersion); doIfTrue(eventData.getRequestParameters(), StringUtils::isNotEmpty, apiRequestDataBuilder::setRequestParameters); doIfTrue(eventData.getUserAgent(), StringUtils::isNotEmpty, apiRequestDataBuilder::setUserAgent); auditEventBuilder.setApiRequestData(apiRequestDataBuilder.build()); } ApiRequestDataBuildUpdater(ApiRequestDataBuilderProvider builderProvider); @Override void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData); @Override Class<ApiRequestData> getType(); }
ApiRequestDataBuildUpdater implements AuditEventBuilderUpdater<ApiRequestData> { @Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData) { AuditProto.ApiRequestData.Builder apiRequestDataBuilder = builderProvider.getNewApiRequestDataBuilder() .setMutating(eventData.isMutating()); doIfTrue(eventData.getApiVersion(), StringUtils::isNotEmpty, apiRequestDataBuilder::setApiVersion); doIfTrue(eventData.getRequestParameters(), StringUtils::isNotEmpty, apiRequestDataBuilder::setRequestParameters); doIfTrue(eventData.getUserAgent(), StringUtils::isNotEmpty, apiRequestDataBuilder::setUserAgent); auditEventBuilder.setApiRequestData(apiRequestDataBuilder.build()); } ApiRequestDataBuildUpdater(ApiRequestDataBuilderProvider builderProvider); @Override void update(AuditProto.AuditEvent.Builder auditEventBuilder, ApiRequestData eventData); @Override Class<ApiRequestData> getType();  }