### Question:
PageSettingsActionAspect { @Before("execution(* com.agiletec.apsadmin.portal.PageSettingsAction.updateSystemParamsForAjax())") public void executeUpdateSystemParams(JoinPoint joinPoint) { HttpServletRequest request = ServletActionContext.getRequest(); PageSettingsAction action = (PageSettingsAction) joinPoint.getTarget(); try { String robotContent = request.getParameter(PARAM_ROBOT_CONTENT_CODE); String alternativePath = request.getParameter(PARAM_ROBOT_ALTERNATIVE_PATH_CODE); InputStream is = (!StringUtils.isBlank(robotContent)) ? new ByteArrayInputStream(robotContent.getBytes("UTF-8")) : null; if (StringUtils.isBlank(alternativePath)) { if (null != is) { this.getStorageManager().saveFile(ROBOT_FILENAME, false, is); } else { this.getStorageManager().deleteFile(ROBOT_FILENAME, false); } } else if (!PageSettingsUtils.isRightPath(alternativePath)) { action.addFieldError(PARAM_ROBOT_ALTERNATIVE_PATH_CODE, action.getText("jpseo.error.robotFilePath.invalid", new String[]{alternativePath})); } else if (this.checkPath(alternativePath, action)) { if (null != is) { this.saveFile(alternativePath, is, action); } else { File file = new File(alternativePath); try { if (file.exists()) { file.delete(); } } catch (Exception e) { logger.error("error deleting file {}", alternativePath); } } } String xmlParams = this.getConfigManager().getConfigItem(SystemConstants.CONFIG_ITEM_PARAMS); Map<String, String> systemParams = SystemParamsUtils.getParams(xmlParams); if (!StringUtils.isEmpty(alternativePath)) { systemParams.put(JpseoSystemConstants.ROBOT_ALTERNATIVE_PATH_PARAM_NAME, alternativePath); } else { systemParams.remove(JpseoSystemConstants.ROBOT_ALTERNATIVE_PATH_PARAM_NAME); } String newXmlParams = SystemParamsUtils.getNewXmlParams(xmlParams, systemParams, true); this.getConfigManager().updateConfigItem(SystemConstants.CONFIG_ITEM_PARAMS, newXmlParams); } catch (Throwable t) { logger.error("error updating page settings for seo", t); action.addActionError("error updating page settings for seo"); } }  @Before("execution(* com.agiletec.apsadmin.admin.BaseAdminAction.configSystemParams())") void executeInitConfig(JoinPoint joinPoint); @Before("execution(* com.agiletec.apsadmin.portal.PageSettingsAction.updateSystemParams())") void executeUpdateSystemParamsForAjax(JoinPoint joinPoint); @Before("execution(* com.agiletec.apsadmin.portal.PageSettingsAction.updateSystemParamsForAjax())") void executeUpdateSystemParams(JoinPoint joinPoint); void setConfigManager(ConfigInterface configManager); void setStorageManager(IStorageManager storageManager); static final String ROBOT_FILENAME; static final String PARAM_ROBOT_CONTENT_CODE; static final String PARAM_ROBOT_ALTERNATIVE_PATH_CODE; static final String SESSION_PARAM_ROBOT_ALTERNATIVE_PATH_CODE; static final String SESSION_PARAM_ROBOT_ALTERNATIVE_PATH_CODE_ERROR; }### Answer:
@Test public void executeUpdateSystemParams_9() throws ApsSystemException { when(configManager.getConfigItem(ArgumentMatchers.anyString())).thenReturn(CONFIG_PARAMETER); Mockito.doThrow(ApsSystemException.class).when(configManager).updateConfigItem(Mockito.anyString(), Mockito.anyString()); actionAspect.executeUpdateSystemParams(joinPoint); Mockito.verify(storageManager, Mockito.times(1)).deleteFile(Mockito.anyString(), Mockito.anyBoolean()); Assert.assertFalse(pageSettingsAction.hasFieldErrors()); Assert.assertTrue(pageSettingsAction.hasActionErrors()); }