IDEA desired refactorings/code generation

It would be nice if IDEA supported a few things we need to do often/regularly (that do not seem too hard to implement.)

1. I would like IDEA to auto generate non-static class & interface wrapper for all static methods in a class. We often need to wrap static helper code so it can be interfaced/mocked.

2. I would like IDEA to auto generate a factory class and interface for any specified class. We often need to create factories so we can test constructors.

3. I would like IDEA to auto generate the unit test class for a class. I want it to auto create all the mocks for all items passed into the constructor. This one might be harder to implement as I'm sure everyone has a slightly different way to code this. This feature might needs lots of customization so it works for all users.

1 comment

Hello dhoffer,

It would be nice if IDEA supported a few things we need to do
often/regularly (that do not seem too hard to implement.)

1. I would like IDEA to auto generate non-static class & interface
wrapper for all static methods in a class. We often need to wrap
static helper code so it can be interfaced/mocked.


This looks like a fairly exotic use case to me. It's very easy to create
a third-party plugin for such wrapper generation, but I'm not sure if it
should be a core product feature.

2. I would like IDEA to auto generate a factory class and interface
for any specified class. We often need to create factories so we can
test constructors.


Doesn't the "Replace constructor with factory method" refactoring do what
you need?

3. I would like IDEA to auto generate the unit test class for a class.
I want it to auto create all the mocks for all items passed into the
constructor. This one might be harder to implement as I'm sure
everyone has a slightly different way to code this. This feature
might needs lots of customization so it works for all users.


Some plugins for JUnit test generation are already available. Have you tried
those?
In general, that doesn't seem to me like a task that can be meaningfully
automated.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.