Mocks injected using the @Mock annotation of the EasyMock plugin have an
automatically generated mock name that is very long and difficult to read.
Steps to reproduce:
1. Create an interface, say my.package.MyClass
2. Create a test case with a field MyClass called myField and decorate it with
a @Mock annotation
3. Make EasyMock.verify(...) fail with the MyClass mock to get an error message
Sample expected output:
Unexpected method call my_package_MyClass_myField.someMethod(): ...
Sample actual output:
Unexpected method call ___________________myField.someMethod(): ...
Cause:
Mock name generation found in EasyMock2TestPlugin@line47
(mycyla-testing-easymock-2.6.jar) appears to incorrectly use the
String#replaceAll(String,String) API on the mock's class name.
Actual usage:
field.getDeclaringClass().getName().replaceAll(".", "_")
(presumably) Intented usage:
field.getDeclaringClass().getName().replaceAll("\\.", "_")
or
field.getDeclaringClass().getName().replace('.', '_')
Direct link:
http://www.google.com/codesearch/p?hl=en#jkOSd3dEr64/mycila-testing/tags/mycila-
testing-2.2/mycila-testing-plugins/mycila-testing-easymock/src/main/java/com/myc
ila/testing/plugin/easymock/EasyMock2TestPlugin.java&q=replaceAll%20package:http
://mycila\.googlecode\.com&l=47
Original issue reported on code.google.com by rodion.m...@gmail.com on 10 Dec 2010 at 3:11
Original issue reported on code.google.com by
rodion.m...@gmail.com
on 10 Dec 2010 at 3:11