### Question:
ManagementApiParser { public Map<String, char[]> getUserMap() throws UserStoreUndefinedException { Map<String, char[]> usersMap = ConfigurationLoader.getUserMap(); if (Objects.nonNull(usersMap)) { return usersMap; } else { throw new UserStoreUndefinedException("UserStore tag not defined inside the Management API"); } }  static File getConfigurationFile(); static String getConfigurationFilePath(); static OMElement getManagementApiElement(); Map<String, char[]> getUserMap();  }### Answer:
@Test public void testGetUserList() throws UserStoreUndefinedException { Map<String, char[]> userMap = new HashMap<>(); userMap.put("user1", "pwd1".toCharArray()); PowerMockito.mockStatic(ConfigurationLoader.class); Mockito.when(ConfigurationLoader.getUserMap()).thenReturn(userMap); ManagementApiParser managementApiParser = new ManagementApiParser(); Map<String, char[]> retrievedUserMap = managementApiParser.getUserMap(); Assert.assertNotNull(retrievedUserMap); Assert.assertEquals("pwd1", new String(retrievedUserMap.get("user1"))); }
@Test(expected = UserStoreUndefinedException.class) public void testGetNullUserStore() throws UserStoreUndefinedException { PowerMockito.mockStatic(ConfigurationLoader.class); Mockito.when(ConfigurationLoader.getUserMap()).thenReturn(null); ManagementApiParser managementApiParser = new ManagementApiParser(); managementApiParser.getUserMap(); }