我有一个间谍或一个对象的模拟,我想验证一个方法已被调用问题,我在执行时收到methodname时间而不是编译时间
我想做的事情如下:
SimpleObj mockObject= Mockito.mock(SimpleObj.class);
Class myClass = SimpleObj.class;
Method meth = myClass.getMethod("getGuid");
Mockito.verify(meth.invoke(mockObject));
Run Code Online (Sandbox Code Playgroud)
我已经使用了一种解决方法
MockingDetails mockingDetails = Mockito.mockingDetails(mockObject);
Collection<Invocation> invocations = mockingDetails.getInvocations();
List<String> methodsCalled = new ArrayList<>();
for (Invocation anInvocation : invocations) {
methodsCalled.add(anInvocation.getMethod().getName());
}
assertTrue(methodsCalled.contains("getGuid");
Run Code Online (Sandbox Code Playgroud)
问题一直有效,直到我使用PowerMockito:对于标准方法,它可以工作,但如果方法是最终的,那么该方法不存在mockingDetails.getInvocations()
(但即使在mockingDetails.getInvocations()
实际verify(mock).getGuid()工作中没有很好地存在)
因此,如果您有任何想法/建议,那将很高兴
问候
我扫描旧的 8 毫米胶片,所以我有包含一组 jpeg 的文件夹
我使用 ffmpeg 将它们转换为电影(我选择 x264 2 pass 编码)
//On all folder that start by 1 I launch the pass1 for x264
for f in 1*/ ; do cd "$f"; ffmpeg -y -r 18 -i img%05d.jpg -c:v libx264 -s 1200x898 -b:v 3000k -pass 1 -an -f mp4 /dev/null; cd ..; done
//On all folder that start by 1 I launch the pass2 x264
for f in 1*/ ; do cd "$f"; ffmpeg -y -r 18 -i img%05d.jpg …Run Code Online (Sandbox Code Playgroud)