### Question:
FailedLoginRatioFilter extends MetadataFilter { @Override protected void apply(final HttpServletRequest request) { final boolean isActive = failedLoginRatioRegistry.isFailedLoginRatioActivated(); request.setAttribute(RequestMetadata.FAILED_LOGIN_RATIO_ACTIVE, isActive); } FailedLoginRatioFilter(final FailedLoginRatioRegistry failedLoginRatioRegistry);   }### Answer:
@Test void metadataWhenActive() { when(registry.isFailedLoginRatioActivated()).thenReturn(true); MockHttpServletRequest request = new MockHttpServletRequest(); filter.apply(request); assertThat(request.getAttribute(RequestMetadata.FAILED_LOGIN_RATIO_ACTIVE)).isEqualTo(true); }
@Test void metadataWhenNotActive() { when(registry.isFailedLoginRatioActivated()).thenReturn(false); MockHttpServletRequest request = new MockHttpServletRequest(); filter.apply(request); assertThat(request.getAttribute(RequestMetadata.FAILED_LOGIN_RATIO_ACTIVE)).isEqualTo(false); }