statistics – hypothesis testing and CI

when can’t we test the hypothesis testing based on confidence interval and when can we?
I just know that one example is since we have used estimator of p to estimate the normal distribution but we use p null in hypothesis testing, they are not equivalence. so, we cannot test the hypothesis testing based on confidence interval.
so, what’s the general method to determine this question?