Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockito/mockito
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.8.1
Choose a base ref
...
head repository: mockito/mockito
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.11.0
Choose a head ref
  • 20 commits
  • 45 files changed
  • 10 contributors

Commits on Oct 19, 2022

  1. Bump junit-platform-launcher from 1.9.0 to 1.9.1 (#2768)

    Bumps [junit-platform-launcher](https://github.com/junit-team/junit5) from 1.9.0 to 1.9.1.
    - [Release notes](https://github.com/junit-team/junit5/releases)
    - [Commits](https://github.com/junit-team/junit5/commits)
    
    ---
    updated-dependencies:
    - dependency-name: org.junit.platform:junit-platform-launcher
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2022
    Configuration menu
    Copy the full SHA
    fe7dca2 View commit details
    Browse the repository at this point in the history
  2. Bump gradle-errorprone-plugin from 2.0.2 to 3.0.1 (#2770)

    Bumps gradle-errorprone-plugin from 2.0.2 to 3.0.1.
    
    ---
    updated-dependencies:
    - dependency-name: net.ltgt.gradle:gradle-errorprone-plugin
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2022
    Configuration menu
    Copy the full SHA
    f512a76 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2022

  1. Bump gradle/wrapper-validation-action from 1.0.4 to 1.0.5 (#2775)

    Bumps [gradle/wrapper-validation-action](https://github.com/gradle/wrapper-validation-action) from 1.0.4 to 1.0.5.
    - [Release notes](https://github.com/gradle/wrapper-validation-action/releases)
    - [Commits](gradle/wrapper-validation-action@v1.0.4...v1.0.5)
    
    ---
    updated-dependencies:
    - dependency-name: gradle/wrapper-validation-action
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 25, 2022
    Configuration menu
    Copy the full SHA
    fcb4cf7 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2022

  1. Configuration menu
    Copy the full SHA
    eb85518 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2022

  1. Configuration menu
    Copy the full SHA
    47045cb View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2022

  1. Avoid clearing stale weak entries from critical code segments (#2780)

    This reduces the probability of checking for mocked from from the
    mock-checking code what can lead to infinitive loops.
    raphw authored Nov 11, 2022
    Configuration menu
    Copy the full SHA
    0052e2f View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2022

  1. Add Mockito.{mock,spy} that take no Class argument (#2779)

    This commit adds method `Mockito.mock()` as a shorter alternative for `Mockito.mock(Class)`.
    When the result of this call is assigned to a variable/field with an explicit type, java will detect
    the needed class automatically.
    
    Co-authored-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
    asolntsev and TimvdLippe authored Nov 14, 2022
    Configuration menu
    Copy the full SHA
    3faa002 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2022

  1. Configuration menu
    Copy the full SHA
    544d0b6 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2022

  1. Bump versions.bytebuddy from 1.12.16 to 1.12.19 (#2799)

    Bumps `versions.bytebuddy` from 1.12.16 to 1.12.19.
    
    Updates `byte-buddy` from 1.12.16 to 1.12.19
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.16...byte-buddy-1.12.19)
    
    Updates `byte-buddy-agent` from 1.12.16 to 1.12.19
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.16...byte-buddy-1.12.19)
    
    Updates `byte-buddy-android` from 1.12.16 to 1.12.19
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.16...byte-buddy-1.12.19)
    
    ---
    updated-dependencies:
    - dependency-name: net.bytebuddy:byte-buddy
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: net.bytebuddy:byte-buddy-agent
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: net.bytebuddy:byte-buddy-android
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 23, 2022
    Configuration menu
    Copy the full SHA
    4086970 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2022

  1. Bump espresso-core from 3.4.0 to 3.5.0 (#2800)

    Bumps espresso-core from 3.4.0 to 3.5.0.
    
    ---
    updated-dependencies:
    - dependency-name: androidx.test.espresso:espresso-core
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 24, 2022
    Configuration menu
    Copy the full SHA
    a8af042 View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2022

  1. Bump kotlinVersion from 1.7.10 to 1.7.21 (#2801)

    Bumps `kotlinVersion` from 1.7.10 to 1.7.21.
    
    Updates `kotlin-gradle-plugin` from 1.7.10 to 1.7.21
    - [Release notes](https://github.com/JetBrains/kotlin/releases)
    - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
    - [Commits](JetBrains/kotlin@v1.7.10...v1.7.21)
    
    Updates `kotlin-stdlib` from 1.7.10 to 1.7.21
    - [Release notes](https://github.com/JetBrains/kotlin/releases)
    - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
    - [Commits](JetBrains/kotlin@v1.7.10...v1.7.21)
    
    ---
    updated-dependencies:
    - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.jetbrains.kotlin:kotlin-stdlib
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 26, 2022
    Configuration menu
    Copy the full SHA
    0ce902a View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2022

  1. Simplify MatcherApplicationStrategy (#2803)

    Prep work for #2796
    
    The class is overly complex, with the precomputed `matchingType` adding to value.
    big-andy-coates authored Nov 28, 2022
    Configuration menu
    Copy the full SHA
    8f4af18 View commit details
    Browse the repository at this point in the history
  2. Bump junit from 1.1.3 to 1.1.4 (#2806)

    Bumps junit from 1.1.3 to 1.1.4.
    
    ---
    updated-dependencies:
    - dependency-name: androidx.test.ext:junit
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 28, 2022
    Configuration menu
    Copy the full SHA
    83a41fd View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2022

  1. Bump kotlinVersion from 1.7.21 to 1.7.22 (#2809)

    Bumps `kotlinVersion` from 1.7.21 to 1.7.22.
    
    Updates `kotlin-gradle-plugin` from 1.7.21 to 1.7.22
    - [Release notes](https://github.com/JetBrains/kotlin/releases)
    - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
    - [Commits](JetBrains/kotlin@v1.7.21...v1.7.22)
    
    Updates `kotlin-stdlib` from 1.7.21 to 1.7.22
    - [Release notes](https://github.com/JetBrains/kotlin/releases)
    - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
    - [Commits](JetBrains/kotlin@v1.7.21...v1.7.22)
    
    ---
    updated-dependencies:
    - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: org.jetbrains.kotlin:kotlin-stdlib
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 29, 2022
    Configuration menu
    Copy the full SHA
    34b8a8d View commit details
    Browse the repository at this point in the history
  2. Bump com.github.ben-manes.versions from 0.42.0 to 0.44.0 (#2810)

    Bumps com.github.ben-manes.versions from 0.42.0 to 0.44.0.
    
    ---
    updated-dependencies:
    - dependency-name: com.github.ben-manes.versions
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 29, 2022
    Configuration menu
    Copy the full SHA
    bdcb31e View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2022

  1. Bump shipkit-auto-version from 1.2.1 to 1.2.2 (#2811)

    Bumps shipkit-auto-version from 1.2.1 to 1.2.2.
    
    ---
    updated-dependencies:
    - dependency-name: org.shipkit:shipkit-auto-version
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 30, 2022
    Configuration menu
    Copy the full SHA
    2567f05 View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2022

  1. Configuration menu
    Copy the full SHA
    ee9ba74 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e2e6289 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2022

  1. Add mockito-subclass artifact (#2821)

    Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
    reta authored Dec 14, 2022
    Configuration menu
    Copy the full SHA
    a4e2e48 View commit details
    Browse the repository at this point in the history

Commits on Dec 28, 2022

  1. Add type() method to ArgumentMatcher (#2807)

    Using the new `type()`, we can differentiate between matching all varargs
    or only one argument of the varargs.
    
    # Benefits:
    
    Because this approach leaves `VarargsMatcher` untouched, it does not require additional existing matchers to implement `VarargsMatcher` to fix issues such as #567. Where as the first PR would require `Null` and `NotNull` to be marked `VarargsMatcher`.
    
    This PR creates new variants of `isNotNull` and `isNull` to address #567. 
    Having `InstanceOf` override `type()` provides a workable solution to #1593.
    Having `equals` override `type` addresses #1222.
    
    # Downsides
    
    The obvious downside is that this changes the public `ArgumentMatcher` interface, though in a backwards compatible way.
    
    ## Known limitation
    
    The main limitation I'm aware of, is not a new limitation. It is that it is not possible to assert only a single parameter is passed to the vararg parameter, when using a `VarargMatcher`, e.g. `any()`. (ref: #1593). For example:
    
    ```java
    // Given method:
    int vararg(String... args);
    
    // I want to mock this invocation:
    mock.vararag("one param");
    
    // ...but not these:
    mock.vararg();
    mock.vararg("more than", "one param");
    ```
    
    There is no current way to do this.  This is because in the following intuitive mocking:
    
    ```java
    given(mock.vararg(any(String.class))).willReturn(1);
    ```
    
    ... matches zero or more vararg parameters, as the `any()` method is using `VarargMatcher`. It seems to me that `VarargMatcher` is... a little broken!  This is maybe something that should be consider a candiate for fixing in the next major version bump.  
    
    While it is not possible to fix any `VarargMatcher` based matchers in a backwards compatible way, this the approach in this PR it is possible to mock/verify exactly one vararg param using `isA`, rather than `any`:
    
    ```java
        @test
        public void shouldMatchExactlyOnParam() {
            mock.varargs("one param");
    
            verify(mock).varargs(isA(String.class));
        }
    
        @test
        public void shouldNotMatchMoreParams() {
            mock.varargs("two", "params");
    
            verify(mock, never()).varargs(isA(String.class));
        }
    
        @test
        public void shouldMatchAnyNumberOfParams() {
            mock.varargs("two", "params");
    
            verify(mock).varargs(isA(String[].class));
        }
    
    ```
    
    ... because `isA` does not implement `VarargsMatcher`, and so can work as expected once it implements `type()`.
    
    Fixes #2796
    Fixes #567
    Fixes #584
    Fixes #1222
    Fixes #1498
    big-andy-coates authored and TimvdLippe committed Dec 28, 2022
    Configuration menu
    Copy the full SHA
    483e15f View commit details
    Browse the repository at this point in the history
Loading