A general framework for testing the Granger noncausality hypothesis