Caching in mobile devices is a new paradigm to revolutionize the traditional data contents (i.e., files) sharing methods in wireless cellular networks. By caching the popular data contents in mobile devices and disseminating these data contents through device-to-device (D2D) communications, the wireless cellular network can improve its area spectral efficiency, save the base station bandwidth consumptions, and reduce the transmission delay of downloading. The caching scheme is closely related to the data popularity prediction, but how to accurately estimate the future popularity profile has not been well understood. Moreover, although the hierarchical caching architecture has been shown to yield more benefits than flat caching strategies, the challenge of designing an optimal hierarchical caching scheme has not been thoroughly addressed. In this paper, we use Neyman- Pearson hypothesis testing mechanism to predict the future data popularity, and also propose and optimal hierarchical caching schemes over D2D wireless ad-hoc networks. The key of Neyman- Pearson hypothesis testing in our proposed scheme is to derive the closed form of the decision threshold, which in a function of costs if choosing the incorrect hypotheses. We formulate these costs as the sum of time durations for content placement phase and content delivery phase. We derive the closed form expressions of these two phases respectively and obtain the closed form of optimal decision rule, which maximizes the cache hitting probability and upperbounds the prediction error probability. Finally, we evaluate and validate our proposed Neyman-Pearson hypothesis testing based hierarchical caching schemes through numerical analyses.