@Test public void resetFactorsTest() throws OktaException { ResponseEntity<Factor> responseEntity = new ResponseEntity<>(expectedFactor, HttpStatus.OK); String expectedRequestBody = "{}"; expect(mockOktaRestService.doRestCall("/api/v1/users/" + expectedUser.getId() + "/lifecycle/reset_factors", HttpMethod.POST, Factor.class, expectedRequestBody)).andReturn(responseEntity); replayAll(); unit.resetFactors(expectedUser); verifyAll(); }
@Override public void resetFactors(OktaUser user) throws OktaException { if (user != null) { String apiPath = String.format(OktaAPIConstants.RESET_FACTORS, user.getId()); ResponseEntity<Factor> exchange = oktaRestService.doRestCall(apiPath, HttpMethod.POST, Factor.class, "{}"); if (!exchange.getStatusCode().is2xxSuccessful()) { throw new OktaException(buildErrorMessage(exchange.getBody())); } } }
FactorLifecycleServiceImpl implements FactorLifecycleService { @Override public void resetFactors(OktaUser user) throws OktaException { if (user != null) { String apiPath = String.format(OktaAPIConstants.RESET_FACTORS, user.getId()); ResponseEntity<Factor> exchange = oktaRestService.doRestCall(apiPath, HttpMethod.POST, Factor.class, "{}"); if (!exchange.getStatusCode().is2xxSuccessful()) { throw new OktaException(buildErrorMessage(exchange.getBody())); } } } }
FactorLifecycleServiceImpl implements FactorLifecycleService { @Override public void resetFactors(OktaUser user) throws OktaException { if (user != null) { String apiPath = String.format(OktaAPIConstants.RESET_FACTORS, user.getId()); ResponseEntity<Factor> exchange = oktaRestService.doRestCall(apiPath, HttpMethod.POST, Factor.class, "{}"); if (!exchange.getStatusCode().is2xxSuccessful()) { throw new OktaException(buildErrorMessage(exchange.getBody())); } } }  }
FactorLifecycleServiceImpl implements FactorLifecycleService { @Override public void resetFactors(OktaUser user) throws OktaException { if (user != null) { String apiPath = String.format(OktaAPIConstants.RESET_FACTORS, user.getId()); ResponseEntity<Factor> exchange = oktaRestService.doRestCall(apiPath, HttpMethod.POST, Factor.class, "{}"); if (!exchange.getStatusCode().is2xxSuccessful()) { throw new OktaException(buildErrorMessage(exchange.getBody())); } } }  @Override Factor enroll(FactorType factorType, ProviderType provider, FactorProfile profile, OktaUser user); @Override Factor activate(String factorId, String passCode, OktaUser user); @Override Factor activate(String href, String passCode); @Override Factor activate(FactorType factorType, String passCode, OktaUser user); @Override void resetFactors(OktaUser user); OktaRestService getOktaRestService(); void setOktaRestService(OktaRestService oktaRestService); FactorService getFactorService(); void setFactorService(FactorService factorService); }
FactorLifecycleServiceImpl implements FactorLifecycleService { @Override public void resetFactors(OktaUser user) throws OktaException { if (user != null) { String apiPath = String.format(OktaAPIConstants.RESET_FACTORS, user.getId()); ResponseEntity<Factor> exchange = oktaRestService.doRestCall(apiPath, HttpMethod.POST, Factor.class, "{}"); if (!exchange.getStatusCode().is2xxSuccessful()) { throw new OktaException(buildErrorMessage(exchange.getBody())); } } }  @Override Factor enroll(FactorType factorType, ProviderType provider, FactorProfile profile, OktaUser user); @Override Factor activate(String factorId, String passCode, OktaUser user); @Override Factor activate(String href, String passCode); @Override Factor activate(FactorType factorType, String passCode, OktaUser user); @Override void resetFactors(OktaUser user); OktaRestService getOktaRestService(); void setOktaRestService(OktaRestService oktaRestService); FactorService getFactorService(); void setFactorService(FactorService factorService);  }