MfaProviderEndpoints implements ApplicationEventPublisherAware { @RequestMapping(value = "{id}", method = GET) public ResponseEntity<MfaProvider> retrieveMfaProviderById(@PathVariable String id) { String zoneId = IdentityZoneHolder.get().getId(); MfaProvider provider = mfaProviderProvisioning.retrieve(id, zoneId); return new ResponseEntity<>(provider, HttpStatus.OK); }  @Override void setApplicationEventPublisher(ApplicationEventPublisher publisher); @RequestMapping(method = POST) ResponseEntity<MfaProvider> createMfaProvider(@RequestBody MfaProvider body); @RequestMapping(value = "{id}", method = PUT) ResponseEntity<MfaProvider> updateMfaProvider(); @RequestMapping(method = GET) ResponseEntity<List<MfaProvider>> retrieveMfaProviders(); @RequestMapping(value = "{id}", method = GET) ResponseEntity<MfaProvider> retrieveMfaProviderById(@PathVariable String id); @RequestMapping(value = "{id}", method = DELETE) ResponseEntity<MfaProvider> deleteMfaProviderById(@PathVariable String id); @ExceptionHandler(InvalidMfaProviderException.class) ResponseEntity<InvalidMfaProviderException> handleInvalidMfaProviderException(InvalidMfaProviderException e); @ExceptionHandler(MfaAlreadyExistsException.class) ResponseEntity<InvalidMfaProviderException> handleInvalidMfaProviderException(MfaAlreadyExistsException e); @ExceptionHandler(EmptyResultDataAccessException.class) ResponseEntity<EmptyResultDataAccessException> handleEmptyResultDataAccessException(EmptyResultDataAccessException e); @ExceptionHandler(MfaProviderUpdateIsNotAllowed.class) ResponseEntity<MfaProviderUpdateIsNotAllowed> handleMfaUpdatingNameOfActiveProvider(MfaProviderUpdateIsNotAllowed e); MfaProviderProvisioning getMfaProviderProvisioning(); void setMfaProviderProvisioning(MfaProviderProvisioning mfaProviderProvisioning); void setMfaProviderValidator(MfaProviderValidator mfaProviderValidator);  }
@Test public void testGetMfaProviderById() { MfaProvider<GoogleMfaProviderConfig> mockProviderResponse = constructGoogleProvider(); String providerId = "1234"; when(provisioning.retrieve(eq(providerId), anyString())).thenReturn(mockProviderResponse); ResponseEntity<MfaProvider> mfaGetResponse = endpoint.retrieveMfaProviderById(providerId); assertEquals(mockProviderResponse, mfaGetResponse.getBody()); verify(provisioning, times(1)).retrieve(providerId, IdentityZoneHolder.get().getId()); assertTrue("got response", mfaGetResponse.getStatusCode().is2xxSuccessful()); }