### Question:
HCatAuthUtil { public static boolean isAuthorizationEnabled(Configuration conf) { return HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED) && SessionState.get().getAuthorizer() != null; }  static boolean isAuthorizationEnabled(Configuration conf);  }### Answer:
@Test public void authEnabledV1Auth() throws Exception { HiveConf hcatConf = new HiveConf(this.getClass()); hcatConf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true); SessionState.start(hcatConf); assertTrue("hcat auth should be enabled", HCatAuthUtil.isAuthorizationEnabled(hcatConf)); }
@Test public void authEnabledV2Auth() throws Exception { HiveConf hcatConf = new HiveConf(this.getClass()); hcatConf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true); hcatConf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, DummyV2AuthorizerFactory.class.getName()); SessionState.start(hcatConf); assertFalse("hcat auth should be disabled", HCatAuthUtil.isAuthorizationEnabled(hcatConf)); }
@Test public void authDisabled() throws Exception { HiveConf hcatConf = new HiveConf(this.getClass()); hcatConf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, false); SessionState.start(hcatConf); assertFalse("hcat auth should be disabled", HCatAuthUtil.isAuthorizationEnabled(hcatConf)); }