object is not an instance of declaring class


錯誤原因:invoke方法的時候,應該是類的實例對象,而不是類本身

解決方法:把

PowerMockito.doReturn(index_expect).when(IndexController.class, "processPage", pageCode, request, response,
model); // Mock私有方法

 改成:

PowerMockito.doReturn(index_expect).when(controller, "processPage", pageCode, request, response,
model); // Mock私有方法


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 object is not an instance of declaring class 報錯:java.lang.IllegalArgumentException: object is not an instance of declaring class java.lang.IllegalArgumentException: object is not an instance of declaring class 項目報錯小記——項目報異常java.lang.IllegalArgumentException: object is not an instance of declaring class及不執行shiro的doGetAuthorizationInfo方法 C++之類(Class),對象(Object)以及實例(Instance)的關系 13_Python的面向對象編程-類class,對象object,實例instance Class與Class 有何區別呢 unity NullReferenceException: Object reference not set to an instance of an object 對類和實例的理解.(class、instance) Java class,Object,Class的區別
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM