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.
我已经使用 EasyMock 构建了一个模拟对象,并且我试图让该对象在方法调用后返回另一个对象。该方法调用不会引发任何异常,但它返回 null,尽管我确信该andReturn()调用有一个非 null 参数。
andReturn()
这里的问题是我在指定行为后没有调用replay()模拟对象。出于某种原因,这导致它允许一些预期的行为,但在预期返回值时总是返回 null。replay()记得在使用模拟之前打电话。
replay()