MfaProviderEndpoints implements ApplicationEventPublisherAware { @RequestMapping(method = POST) public ResponseEntity<MfaProvider> createMfaProvider(@RequestBody MfaProvider body) { String zoneId = IdentityZoneHolder.get().getId(); body.setIdentityZoneId(zoneId); mfaProviderValidator.validate(body); if(!StringUtils.hasText(body.getConfig().getIssuer())){ body.getConfig().setIssuer(IdentityZoneHolder.get().getName()); } MfaProvider created = mfaProviderProvisioning.create(body,zoneId); return new ResponseEntity<>(created, HttpStatus.CREATED); }  @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 testCreateDefaultIssuer() { MfaProvider<GoogleMfaProviderConfig> mfaProvider = constructGoogleProvider(); Mockito.when(provisioning.create(Mockito.any(), Mockito.anyString())).thenReturn(mfaProvider); ResponseEntity<MfaProvider> mfaProviderResponseEntity = endpoint.createMfaProvider(mfaProvider); assertEquals(IdentityZoneHolder.get().getName(), mfaProviderResponseEntity.getBody().getConfig().getIssuer()); }