### Question:
SecurityUtil { public static void login(final Configuration conf, final String keytabFileKey, final String userNameKey) throws IOException { login(conf, keytabFileKey, userNameKey, getLocalHostName()); }  static void fetchServiceTicket(URL remoteHost); static String getServerPrincipal(String principalConfig,
      String hostname); static String getServerPrincipal(String principalConfig,
      InetAddress addr); static void login(final Configuration conf,
      final String keytabFileKey, final String userNameKey); static void login(final Configuration conf,
      final String keytabFileKey, final String userNameKey, String hostname); static String buildDTServiceName(URI uri, int defPort); static String getHostFromPrincipal(String principalName); @InterfaceAudience.Private static void setSecurityInfoProviders(SecurityInfo... providers); static KerberosInfo getKerberosInfo(Class<?> protocol, Configuration conf); static TokenInfo getTokenInfo(Class<?> protocol, Configuration conf); static final Log LOG; static final String HOSTNAME_PATTERN; }### Answer:
@Test public void testStartsWithIncorrectSettings() throws IOException { Configuration conf = new Configuration(); conf.set( org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); String keyTabKey="key"; conf.set(keyTabKey, ""); UserGroupInformation.setConfiguration(conf); boolean gotException = false; try { SecurityUtil.login(conf, keyTabKey, "", ""); } catch (IOException e) { gotException=true; } assertTrue("Exception for empty keytabfile name was expected", gotException); }