### Question:
ContentAdminAction extends BaseAdminAction { @Override public String updateSystemParams() { String result = this.updateSystemParams(true); if (!result.equals(SUCCESS)) { return result; } try { Map<String, List<String>> newMapping = this.buildMapping(); this.getResourceManager().updateMetadataMapping(newMapping); } catch (Throwable t) { logger.error("error in configSystemParams", t); return FAILURE; } return SUCCESS; }  @Override void validate(); @Override String configSystemParams(); String buildCsv(String key); @Override String updateSystemParams(); String addMetadata(); String removeMetadata(); String reloadContentsIndex(); String reloadContentsReference(); List<String> getResourceMetadataKeys(); int getContentManagerStatus(); int getSearcherManagerStatus(); int getContentManagerState(); int getSearcherManagerState(); LastReloadInfo getLastReloadInfo(); Map<String, List<String>> getMapping(); void setMapping(Map<String, List<String>> mapping); String getMetadataKey(); void setMetadataKey(String metadataKey); List<String> getMetadataKeys(); String getMetadataMapping(); void setMetadataMapping(String metadataMapping); void setMetadataKeys(List<String> metadataKeys); void setContentManager(IContentManager contentManager); String getAspectRatio(); void setAspectRatio(String aspectRatio); List<String> getRatio(); void setRatio(List<String> ratio); void setSearchEngineManager(ICmsSearchEngineManager searchEngineManager); void setResourceManager(IResourceManager resourceManager);  }### Answer:
@Test public void updateSystemParams_1() throws Exception { when(configManager.getConfigItem(ArgumentMatchers.anyString())).thenReturn(CONFIG_PARAMETER); Enumeration mockedEnumerator = Mockito.mock(Enumeration.class); when(mockedEnumerator.hasMoreElements()).thenReturn(false); when(request.getParameterNames()).thenReturn(mockedEnumerator); Mockito.doThrow(ApsSystemException.class).when(configManager).updateConfigItem(Mockito.anyString(), Mockito.anyString()); String result = action.updateSystemParams(); Assert.assertEquals(BaseAction.FAILURE, result); Mockito.verify(resourceManager, Mockito.times(0)).updateMetadataMapping(Mockito.any(Map.class)); }
@Test public void updateSystemParams_2() throws Exception { when(configManager.getConfigItem(ArgumentMatchers.anyString())).thenReturn(CONFIG_PARAMETER); Enumeration mockedEnumerator = Mockito.mock(Enumeration.class); when(mockedEnumerator.hasMoreElements()).thenReturn(false); when(request.getParameterNames()).thenReturn(mockedEnumerator); String result = action.updateSystemParams(); Assert.assertEquals(BaseAction.SUCCESS, result); Mockito.verify(resourceManager, Mockito.times(1)).updateMetadataMapping(Mockito.any(Map.class)); Mockito.verify(configManager, Mockito.times(1)).updateConfigItem(Mockito.anyString(), Mockito.anyString()); }