ServiceUserConfigService { public Map<String, Map<String, String>> getServiceUserConfigs(String clusterName) { Map<String, Object> hadoopConfig = (new Gson()).fromJson(clusterEntityManager.findByName(clusterName).getHadoopConfig(), Map.class); Map<String, Map<String, String>> serviceUserConfigs = hadoopConfig != null ? (Map<String, Map<String, String>>) hadoopConfig.get(UserMgmtConstants.SERVICE_USER_CONFIG_IN_SPEC_FILE) : null; if(MapUtils.isEmpty(serviceUserConfigs)) { LOGGER.info("no service user configuration, no need to configure service users for cluster"); } return serviceUserConfigs; }  Map<String, Map<String, String>> getServiceUserConfigs(String clusterName); Set<String> getServiceUserGroups(Map<String, Map<String, String>> serviceUserConfigs);  }
@Test (expectedExceptions = NullPointerException.class) public void testGetServiceUserConfigs() throws Exception { MockedClusterEntityManager manager = new MockedClusterEntityManager(); System.out.println("hadoop config is: " + manager.findByName("cluster").getHadoopConfig()); userConfigService.getServiceUserConfigs("cluster"); }