Skip to content

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 25, 2024

Bumps org.mockito:mockito-core from 5.3.1 to 5.10.0.

Release notes

Sourced from org.mockito:mockito-core's releases.

v5.10.0

Changelog generated by Shipkit Changelog Gradle Plugin

5.10.0

v5.9.0

What's Changed

New Contributors

Full Changelog: mockito/mockito@v5.8.0...v5.9.0

v5.8.0

Changelog generated by Shipkit Changelog Gradle Plugin

5.8.0

... (truncated)

Commits
  • 7e1bae8 Bump org.shipkit:shipkit-auto-version from 1.2.2 to 2.0.2 (#3248)
  • cf89d49 Bump org.assertj:assertj-core from 3.25.1 to 3.25.2 (#3247)
  • cc2ca36 Bump org.shipkit:shipkit-changelog from 1.2.0 to 2.0.1 (#3245)
  • ed01de6 Bump com.diffplug.spotless from 6.24.0 to 6.25.0 (#3244)
  • ef3dc8f Improve typing for PluginLoader#loadPlugin(..) (#3242)
  • 33dc48c Bump com.github.ben-manes.versions from 0.50.0 to 0.51.0 (#3241)
  • 9173522 Add support for static mocks on DoNotMockEnforcer (#3220)
  • a021436 Bump com.diffplug.spotless from 6.23.3 to 6.24.0 (#3236)
  • e4fa639 Align Javadoc configuration to Java 21 standards (#3230)
  • 71e2fdb Bump org.gradle.toolchains.foojay-resolver-convention (#3234)
  • Additional commits viewable in compare view

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot requested review from a team as code owners January 25, 2024 00:21
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Jan 25, 2024
Zabuzard
Zabuzard previously approved these changes Jan 25, 2024
@Zabuzard Zabuzard dismissed their stale review January 25, 2024 08:00

checks fail

@SquidXTV
Copy link
Member

I just checked for the ping command and it seems like that it fails because of this:

        UnaryOperator<SlashCommandInteractionEvent> mockOperator = event -> {
            SlashCommandInteractionEvent SlashCommandInteractionEvent = spy(event);
            mockInteraction(SlashCommandInteractionEvent);
            return SlashCommandInteractionEvent;
        };

especially the spy(event).

java.lang.IllegalArgumentException: Please don't pass mock here. Spy is not allowed on mock.
	at org.mockito.Mockito.spy(Mockito.java:2188)
	at org.togetherjava.tjbot.jda.JdaTester.lambda$createSlashCommandInteractionEvent$0(JdaTester.java:248)
	at org.togetherjava.tjbot.jda.SlashCommandInteractionEventBuilder.spySlashCommandEvent(SlashCommandInteractionEventBuilder.java:256)
	at org.togetherjava.tjbot.jda.SlashCommandInteractionEventBuilder.build(SlashCommandInteractionEventBuilder.java:250)
	at org.togetherjava.tjbot.features.basic.PingCommandTest.triggerSlashCommand(PingCommandTest.java:19)
	at org.togetherjava.tjbot.features.basic.PingCommandTest.pingRespondsWithPong(PingCommandTest.java:35)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

It seems like it's already a Mock and thus is an illegal argument here.
If you check source:

if (MockUtil.isMock(object)) {
    throw new IllegalArgumentException("Please don't pass mock here. Spy is not allowed on mock.");
}

For me it seems like that the spy() is applied twice:

    private SlashCommandInteractionEvent spySlashCommandEvent(String jsonData) {
        SlashCommandInteractionEvent event = spy(new SlashCommandInteractionEvent(jda, 0,
                new SlashCommandInteractionImpl(jda, DataObject.fromJson(jsonData))));
        event = mockOperator.apply(event);

What should I do to fix this?
What is even the usage of mockOperator? It seems like that the mockInteraction() method needs it to be a mock, so is this a good idea to do:

        UnaryOperator<SlashCommandInteractionEvent> mockOperator = event -> {
            if (!MockUtil.isMock(event)) {
                event = spy(event);
            }
            mockInteraction(event);
            return event;
        };

it would fix all tests. :D

@SquidXTV SquidXTV force-pushed the dependabot/gradle/org.mockito-mockito-core-5.10.0 branch from a36bdde to 700aaeb Compare February 15, 2024 23:08
@Taz03 Taz03 mentioned this pull request Feb 21, 2024
@SquidXTV SquidXTV force-pushed the dependabot/gradle/org.mockito-mockito-core-5.10.0 branch from 700aaeb to d5a80e7 Compare February 22, 2024 10:30
@Taz03
Copy link
Member

Taz03 commented Feb 22, 2024

@dependabot rebase

Copy link
Contributor Author

dependabot bot commented on behalf of github Feb 22, 2024

Looks like this PR has been edited by someone other than Dependabot. That means Dependabot can't rebase it - sorry!

If you're happy for Dependabot to recreate it from scratch, overwriting any edits, you can request @dependabot recreate.

dependabot bot and others added 2 commits February 29, 2024 20:26
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.3.1 to 5.10.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.3.1...v5.10.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@SquidXTV SquidXTV force-pushed the dependabot/gradle/org.mockito-mockito-core-5.10.0 branch from d5a80e7 to faf14a3 Compare February 29, 2024 19:26
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor Author

dependabot bot commented on behalf of github Mar 4, 2024

A newer version of org.mockito:mockito-core exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

@SquidXTV
Copy link
Member

SquidXTV commented Mar 4, 2024

A newer version of org.mockito:mockito-core exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

What should I do about this?

@Taz03
Copy link
Member

Taz03 commented Mar 5, 2024

What should I do about this?

nothing, after this pr merges everything will be fine (not like we gonna miss something in the new update). And if u really want to upgrade the version manually

@SquidXTV SquidXTV self-assigned this Mar 5, 2024
@Taz03 Taz03 merged commit a6ac181 into develop Mar 12, 2024
@Taz03 Taz03 deleted the dependabot/gradle/org.mockito-mockito-core-5.10.0 branch March 12, 2024 09:06
Taz03 pushed a commit that referenced this pull request Mar 13, 2024
* Bump org.mockito:mockito-core from 5.3.1 to 5.10.0

Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.3.1 to 5.10.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.3.1...v5.10.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix tests failing with new version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Schweighoefer <[email protected]>
@ankitsmt211 ankitsmt211 mentioned this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants