preserve method parameter names
Brought to you by:
ivan_r_moore,
mpcooke3
The generated mock class doesn't seem to preserve the
method names specified in the interface for which the
class was generated.
Example: Let's say I want to generate a mock
implementation for the interface Foo defined as
follows:
public interface Foo {
setBar(Object bar);
}
The generated mock implementation class MockFoo will
have the method defined as follows:
setBar(Object arg0) {
...
}
I think it would be nice if the argument names were
preserved, as it is easier to understand the code when
reading it. Sometimes you want to make adaptions to
the generated code.
Logged In: YES
user_id=136463
I'm not sure how easy this is to do at the moment. Mockmaker
works on the compiled bytecode files and I don't think these
files keep the parameter names. To do this I think we would
need to be generating mocks from source files.
Logged In: YES
user_id=455308
Although I think the method parameter names are stored in
the bytecode files, the java.lang.reflect package does
unfortunately not provide access to them. Other packages
such as BCEL (http://jakarta.pache.org/bcel/) provide this
access. They would also allow to write the mock classes to
bytecode directly, instead of Java source. But that's of
course not always desirable...