### Question:
SecurityUtil { static boolean isTGSPrincipal(KerberosPrincipal principal) { if (principal == null) return false; if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; }  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 isOriginalTGTReturnsCorrectValues() { assertTrue(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/foo@foo"))); assertTrue(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/foo.bar.bat@foo.bar.bat"))); assertFalse(SecurityUtil.isTGSPrincipal (null)); assertFalse(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("blah"))); assertFalse(SecurityUtil.isTGSPrincipal (new KerberosPrincipal(""))); assertFalse(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/hello"))); assertFalse(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("/@"))); assertFalse(SecurityUtil.isTGSPrincipal (new KerberosPrincipal("krbtgt/foo@FOO"))); }