Error trying to mock constructor for ProcessBuilder using PowerMockito
I am trying to mock the constructor for ProcessBuilder. The problem is that when the constructor is called it return null. Class code: public static void enable() throws IOException, InterruptedException { logger.info("Enable NTP server..."); String ntpAddress = AppConfig.getInstance().getString(AppConfig.NTP_SERVER, ""); AppConfig.getInstance().getBoolean(AppConfig.NTP_ENABLED, true); String enableNtp = "chkconfig ntpd on " + SEPARATOR + " service ntpd stop " + SEPARATOR + " ntpdate " + ntpAddress + " " + SEPARATOR + " service ntpd start"; String[] commandArr = {"bash", "-c", enableNtp};