Move method in Class
Hi,
I have a method that I have created for an object in my unit test. The
method (could be a constructor) does not exist in the class. What
shortcut/menu option can I use to create it in the class?
Sham.
Please sign in to leave a comment.
Hello Shamresh,
I'm not sure I understand your post correctly but it you mean creating
method from a usage you just need to place your caret at the usage. Then
a lightbulb should appear at the left side of the text editior. Click the
bulb (or press Alt+Enter) and choose "Create method" from the dropdown menu.
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
To generate a constructor (if you need) you can press ALT-Ins, or ALT-Enter as suggested above if you are creating a called (but as yet undefined) method.
Thanks.
Still learning how to use ReSharper so thanks for all the help.
What I found is that if I have the caret on the parameter variable of the
constructor (i..e new EmployeeTask(mockGateway); caret is anywhere on
mockGateway), then pressing ALT+Enter gives me the option to create a
constructor. However, if I press ALT+Ins with the caret where it is, a
constructor is created but it is parameterless.
Also, if the caret is not on the parameter (i.e. on EmployeeTask), then
ALT+Ins creates a parameterless constructor as above but there is no quick
fix (ALT+Enter) option.
This cannot be correct or is it how it is supposed to work (in other words
the caret has to be in the correct position and I have to press the correct
short key).
Sham.
"Chadwick Posey" <no_reply@jetbrains.com> wrote in message
news:4921521.1182535941024.JavaMail.itn@is.intellij.net...
Hi,
Sorry ignore my last reply.
Sham.
"Shamresh" <shamresh@inspirationmatters.com> wrote in message
news:f5jmmg$qkl$1@is.intellij.net...
>
>
>
>
>
>
>> To generate a constructor (if you need) you can press ALT-Ins, or
>> ALT-Enter as suggested above if you are creating a called (but as yet
>> undefined) method.
>