weirddev

Open full view…

@RunWith(MockitoJUnitRunner.class)

MightyDash
Mon, 06 Mar 2017 15:13:52 GMT

Would it be possible to add option to generate tests with @RunWith(MockitoJUnitRunner.class) instead of @BeforeEach void setUp() { MockitoAnnotations.initMocks(this); } Thanks for great plugin!

Yaron
Wed, 08 Mar 2017 22:17:49 GMT

Thanks for your feedback and support! I would like to make the test templates configurable as the existing Velocity templates in IJ. So users could add their customized code/test generators as additional UI actions to the TestMe popup. This requires some effort. I'm currently focused on the basic test generators. Adding a specialized configuration option is also something to consider. For now, if you don't mind deleting the auto generated @Before block manually, I can offer you a hack to autogenerate the TestRunner. You can customize the File Header template in IJ: Settings -> Editor -> File and Code Templates. Copy/Paste the following 3 lines as is to the bottom: ` #if($TESTED_CLASS_FIELDS && !$TESTED_CLASS_FIELDS.isEmpty()) @org.junit.runner.RunWith(org.mockito.junit.MockitoJUnitRunner.class) #end ` (* nevermind the vebosity of the fully qualified package names - they will be removed automatically as long as _Junit_ and _Mockito_ actually exist on the project/module classpath) I've attached a screenshot to clarify: [FileHeaderHack](//muut.com/u/weirddev/s2/:weirddev:lbkK:fileheaderhack.png.jpg) Cheers