### Question:
FactorEnrollmentAPIController { @RequestMapping(method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteFactor(@RequestParam("factorId") String id, Authentication auth) throws OktaException { Preconditions.checkNotNull(id, "factor id is null"); try { LOGGER.info("Deleting factor [{}] for user [{}]", id, auth.getName()); OktaUser user = getOktaUserService().getUser(auth.getName()); getFactorService().deleteFactor(id, user); } catch (Exception e) { LOGGER.error("Failed to delete factor [{}] for user [{}]", id, auth.getName(), e); throw new OktaException(e.getMessage(), e); } }  @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List<Factor> findEnrolledFactors(Authentication auth); @RequestMapping(value = "available", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List<Factor> findAvailableFactors(Authentication auth); @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody Factor enrollFactor(@RequestBody Factor enrollRequestDTO, Authentication auth); @RequestMapping(value = "activate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody Factor activateFactor(@RequestBody ActivateRequestDTO activateRequestDTO, Authentication auth); @RequestMapping(value = "reset", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody void activateFactor(Authentication auth); @RequestMapping(method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody void deleteFactor(@RequestParam("factorId") String id, Authentication auth); FactorService getFactorService(); void setFactorService(FactorService factorService); FactorLifecycleService getFactorLifecycleService(); void setFactorLifecycleService(FactorLifecycleService factorLifecycleService); OktaUserService getOktaUserService(); void setOktaUserService(OktaUserService oktaUserService);  }### Answer:
@Test public void deleteFactorTest() throws Exception { expect(mockAuthentication.getName()).andReturn(expectedUser.getId()).atLeastOnce(); expect(mockOktaUserService.getUser(expectedUser.getId())).andReturn(expectedUser); mockFactorService.deleteFactor(expectedFactor.getId(), expectedUser); EasyMock.expectLastCall(); replayAll(); MvcResult mvcResult = mockMvc.perform( delete("/api/latest/plugin/okta/factor/enrollment?factorId={factorId}", expectedFactor.getId()) .accept(MediaType.APPLICATION_JSON) .session(mockHttpSession) .principal(mockAuthentication)) .andReturn(); verifyAll(); MockHttpServletResponse response = mvcResult.getResponse(); assertEquals(HttpStatus.OK.value(), response.getStatus()); }