Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个功能如下:
class A { static funcA(HashMap<String, Boolean> h); }
我必须模拟这个方法 funcA 所以,我在做
PowerMockito.when(A.funcA(anyObject());
现在,我收到 funcA 不适用于 Object 的错误。如何获得哈希图的匹配项,例如 anyString() 或 anyInt() ?
尝试这样做:
any(HashMap.class)
它应该匹配您指定的类的任何实例(HashMap在本例中)
HashMap