@Test
public void testKinitPathFind() {

    Assume.assumeTrue("this test requires kerberos properties set kerberos enabled", kerberosSparkProperties.isKerberosEnabled());
    File foundScript = kerberosUtils.getKinitPath(DEFAULT_KINIT_PATH);
    assertThat(foundScript).isEqualTo(DEFAULT_KINIT_PATH);
    logger.info("'/usr/bin/kinit' found by getKinitPath");
    // on systems that support the which command we make sure it is the chosen result from getKinitPath when no property 'kerberos.spark.kinitPath' is set
    if (processRunner.runScript("which", Arrays.asList("kinit"))) {
        String pathFromWhich = StringUtils.chomp(processRunner.getOutputFromLastCommand());
        File actualResultOfWhich = new File(pathFromWhich);
        logger.debug("actualResultOfWhich='{}'", actualResultOfWhich);
        foundScript = kerberosUtils.getKinitPath(null);
        assertThat(foundScript).isEqualTo(actualResultOfWhich);
        logger.info("kinit was found using which");
        // our config file will have the kerberos.spark.kinitPath property missing, ensure /usr/bin/kinit comes back from scanning system path
        assertThat(kerberosSparkProperties.getKinitPath()).isEqualTo(actualResultOfWhich);
    }
}