Skip to content

Fix SonarCloud: Replace deprecated EntityDamageByEntityEvent and LingeringPotion in tests#2817

Merged
tastybento merged 1 commit intodevelopfrom
fix/sonar-pr7-test-deprecated
Mar 3, 2026
Merged

Fix SonarCloud: Replace deprecated EntityDamageByEntityEvent and LingeringPotion in tests#2817
tastybento merged 1 commit intodevelopfrom
fix/sonar-pr7-test-deprecated

Conversation

@tastybento
Copy link
Member

Summary

  • Replace all 22 deprecated 6-arg EntityDamageByEntityEvent constructors (using DamageModifier, Guava Function/ImmutableMap) with simpler 5-arg constructor via a new createDamageEvent helper method in PVPListenerTest
  • Replace 6 mock(LingeringPotion.class) with mock(ThrownPotion.class)
  • Remove unused Guava imports: Function, Functions, ImmutableMap, EnumMap, DamageModifier

Other test files (BreakBlocksListenerTest, HurtingListenerTest, ItemFrameListenerTest, TNTListenerTest) already use the non-deprecated constructors.

Risk

Medium-High — test rewrite, must maintain coverage.

Test plan

  • ./gradlew clean test passes
  • SonarCloud re-scan confirms reduction in deprecated API warnings

🤖 Generated with Claude Code

…gPotion in PVPListenerTest

Replace all 22 occurrences of the deprecated 6-arg EntityDamageByEntityEvent
constructor (using DamageModifier, Guava Function/ImmutableMap) with the simpler
5-arg constructor via a new createDamageEvent helper method.

Replace deprecated LingeringPotion.class mocks with ThrownPotion.class.

Remove unused imports: EnumMap, DamageModifier, com.google.common.base.Function,
Functions, ImmutableMap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

@tastybento tastybento merged commit 58ccdd5 into develop Mar 3, 2026
3 checks passed
@tastybento tastybento deleted the fix/sonar-pr7-test-deprecated branch March 3, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant