### Question:
AuditRequestBodyAdvice extends RequestBodyAdviceAdapter { @Override public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { Method method = methodParameter.getMethod(); if (method == null) { return false; } return "createConsent".equals(method.getName()); }  @Override boolean supports(MethodParameter methodParameter,
                            Type targetType,
                            Class<? extends HttpMessageConverter<?>> converterType); @Override Object afterBodyRead(Object body,
                                HttpInputMessage inputMessage,
                                MethodParameter parameter,
                                Type targetType,
                                Class<? extends HttpMessageConverter<?>> converterType);  }### Answer:
@Test void supportsMethodIsNull() { AuditRequestBodyAdvice advice = new AuditRequestBodyAdvice(); boolean supports = advice.supports(methodParameter, null, null); assertThat(supports).isFalse(); }
@Test void supportsMethodIsDifferent() throws NoSuchMethodException { Method method = AccountInformationService.class.getMethod("getConsentStatus", String.class, RequestHeaders.class, RequestParams.class); doReturn(method).when(methodParameter).getMethod(); boolean supports = advice.supports(methodParameter, null, null); assertThat(supports).isFalse(); method = AccountInformationService.class.getMethod("createConsent", RequestHeaders.class, RequestParams.class, Consents.class); doReturn(method).when(methodParameter).getMethod(); supports = advice.supports(methodParameter, null, null); assertThat(supports).isTrue(); }
@Test void supports() throws NoSuchMethodException { AuditRequestBodyAdvice advice = new AuditRequestBodyAdvice(); Method method = AccountInformationService.class.getMethod("createConsent", RequestHeaders.class, RequestParams.class, Consents.class); doReturn(method).when(methodParameter).getMethod(); boolean supports = advice.supports(methodParameter, null, null); assertThat(supports).isTrue(); }