I have the following code:
verify(javaCompiler, times(1)).writeJavaAndCompile(any(ContractCompilationUnit.class), eq(outputDirectory));
verify(javaCompiler, times(1)).writeJavaAndCompile(any(ParamCompilationUnit.class), eq(outputDirectory));
and my code is the following:
javaCompiler.writeJavaAndCompile(new ContractCompilationUnit(), outputDirectory);
javaCompiler.writeJavaAndCompile(new ParamCompilationUnit(), outputDirectory);
The code is failing, as it seems that the 1st verify sees that there were 2 calls to javaCompiler.writeJavaAndCompile(). It is failing to realize that there was only one call of type ContractCompilationUnit type.
What’s the standard procedure to avoid this behaviour (other than having to write my own matcher)?
The documentation shows that this is the known behaviour:
It looks like you should use
isAinstead: