Skip to content

Releases: picimako/mockitools

v0.11.0

15 Jul 08:18

Choose a tag to compare

Added

  • #53: Added an inspection to report when the mocked type and the type of the spied instance don't match in a mock(Type.class, withSettings().spiedInstance(...));-type mock creation.
  • #56: Added an inspection to report spying on mock objects, i.e. Mockito.spy(Mockito.mock(...)) and Mockito.spy(<object annotated with @Mock>).
  • #57: Added an inspection to report arguments passed into Mockito.mock() and Mockito.spy() which are designed to determine the mock type based on the variable's type they are assigned to, and not by the type passed into them. See Mocking/spying without specifying class.
  • #58: Added an inspection to report MockSettings-based mock creations that have convenience methods or simpler variants to create the mock.
  • #59: Added an intention action to expand simple mock and spy creation calls to use specific MockSettings, for example Mockito.mock(<type>, <answer>) is converted to Mockito.mock(<type>, Mockito.withSettings().defaultAnswer(<answer>)).

Changed

  • Plugin configuration updates, and code improvements specific to migrating from Java 11 to 17.

v0.10.0

19 Jun 09:00
4bd75ad

Choose a tag to compare

  • New support range of IDEs: 2022.2-2023.2
  • Disabled the v3 to v4 migration aids inspections since Mockito 4.x has already been released for 1.5 years.
  • #49: Added support for the withoutAnnotations attribute of the @Mock annotation.
  • Underlying plugin configuration updates, and test optimizations.
  • Update inspection description documents to enable code snippet syntax highlighting in them starting from IJ 2023.2.

v0.9.0

05 Mar 11:36
fee53a8

Choose a tag to compare

Changed

  • Dropped support for IJ-2021.3.
  • Added support for IJ-2023.1.
  • Minor simplifications under the hood.

v0.8.0

06 Oct 11:57
2231918

Choose a tag to compare

Added

  • #37: Added inspection to report stub-only mocks when they are used verifications.
  • #43: Added support for converting the mockMaker mock setting between the @Mock annotation and MockSettings.
  • Added missing support for the conversion of the strictness mock setting from @Mock to MockSettings.

Changed

  • Dropped support for IJ-2021.2.
  • Added support for IJ-2022.3 EAPs.

v0.7.0

18 Aug 06:17

Choose a tag to compare

Added

  • #36: Added inspection to report toString() calls in verifications, since Mockito cannot verify toString().
  • #39: Added inspection to report *Return() stubbing calls, if the stubbed method's return type is void.
  • #40: Added inspection to report doNothing() and willDoNothing() stubbing calls,
    if the stubbed method's return type is not void.

Changed

  • #41: Cleaned up the class and package name, and modified the icons in the target method selection
    popup during mock field conversion. The new icons can help distinguish between before hooks, test methods, and the rest of the methods.
  • Refactorings and housekeeping in the mock stubbing and verification areas.

v0.6.0

29 Jul 10:39
2003be9

Choose a tag to compare

Added

  • #29: Added intentions to convert verifications between InOrder.verify() and MockedStatic.verify().
  • #30: Added inspection reporting for usages of MockedStatic.reset().
  • #32: Added support for MockedStatic stubbing to report mergeable *Return() and *Throw() method calls.
  • #33: Added bulk conversion for stubbing call chains. It works the same way as bulk conversion works for verifications.

Changed

  • #31: Modified the analysis process of times(1) calls to specifically check for the verification methods they are used at.
    Also optimized the whole times(X) analysis.
  • #33: Reorganized the stubbing conversion intention actions.
    Now, only the Convert stubbing(s) to... intention is displayed, and after selecting it, the actual target options become visible.

Fixed

  • Fixed an issue when the editor selection was suitable enough, but it didn't actually contain a statement, the stubbing and verification
    intentions were still available.

v0.5.0

03 Jul 06:05
1e85a69

Choose a tag to compare

Added

  • #19: Added bulk options to convert verifications from BDDMockito.then() and Mockito.verify() by selecting one or more
    verifications in the editor.
  • #20: Extended the conversion of InOrder.verify() call chains with a bulk mode,
    so that if multiple (or just a single) such call chain is selected/highlighted in the editor, they all can be converted to the same approach at once.
  • #21: Added an inspection to report InOrder local variables that are used in only one verification call.
    Besides MockedStatic, it can report for both InOrder.verify() and BDDMockito.then().should(InOrder) verifications.
  • #22: Added a new action to convert from and to InOrder.verify() based verification.
    Along with it, extended the possible conversion options from and to Mockito.verify() and BDDMockito.then() as well.
    Details are available in the Verifications document.
  • #23: Added a quick fix, so that checked exceptions can be added to the stubbed method's throws clause
    when they are specified in the stubbing, but not in the mentioned throws clause.
  • #24: Strictness configuration is now supported by the conversion between @Mock and Mockito.mock(Class, MockSettings) in both directions.
  • EnforceConventionInspection can now report InOrder.verify() calls too, as part of enforcing BDDMockito.then() verification.
  • #27: Added an inspection that can report mock objects used in misconfigured InOrder verifications.

Changed

  • Removed support for IJ2021.1. From now on 2021.2 is the earliest version supported.

Fixed

  • Fixed an issue that when converting from BDDMockito.then().should(InOrder) to Mockito.verify() the InOrder variable remained.

v0.4.1

09 Jun 14:23
53d5527

Choose a tag to compare

Changed

  • Added support for IJ2022.2.
  • Removed Mockitools: prefix from inspection messages. This might help make them more comprehensible, and it removes
    the clutter when they are displayed in the code analysis results tool window.
  • Refactored some intention classes to prevent EDT slow operations errors, and other housekeeping.

v0.4.0

28 Apr 12:09
a6bf663

Choose a tag to compare

Added

  • #4: Added an intention action that can convert Mockito.mock() calls to @Mock annotated fields.
  • #8: Added a new inspection that reports multiple consecutive calls on *Throw() stubbing calls.
    They can be merged into a single such call.
  • #8: Merging of consecutive *Return() and *Throw() stubbing calls can happen separately if
    there are multiple such sections within a stubbing call chain. They, from now on, also keep line wrapping and indentation after applying the quick fix.
  • #12: Added a new intention action that can convert arguments of *Throw() stubbing methods
    from Type.class expressions to new Type() expressions and vice versa.
  • #13: Added 4 new intention actions that can convert between the various stubbing approaches.
  • #15: Added 2 new intention actions that can convert between the Mockito.verify()
    and BDDMockito.then() approaches, and vice versa.
  • #16: Added a new inspection that can enforce org.mockito.Mockito or org.mockito.BDDMockito based
    stubbing and verification.

v0.3.0

08 Mar 09:21
1cc86af

Choose a tag to compare

  • IntelliJ version support: versions prior to 2021.1 are no longer supported.

Added

  • Added a new inspection to report checked exceptions in *Throw() stubbing calls that are not specified in the stubbed method's throws clause.
    See documentation.
  • #8: Added a new inspection that reports multiple consecutive calls on *Return() stubbing calls. These can be merged into a single such call.
    See documentation.

Changed

  • Updated Gradle IntelliJ plugin to 1.4.0, gradle to 7.4, and qodana-action to 4.2.5.
  • Replaced unit test file checks with a less restrictive, test source root content check, because unit test file names don't necessarily end with the word Test.
    This will allow certain functionality to run in files whose names don't end with Test.