Slimefun / Slimefun4

Slimefun 4 - A unique Spigot/Paper plugin that looks and feels like a modpack. We've been giving you backpacks, jetpacks, reactors and much more since 2013.
GNU General Public License v3.0
972 stars 544 forks source link

Actually check if the negative tests do their job #4054

Closed Sfiguz7 closed 7 months ago

Sfiguz7 commented 11 months ago

Description

While adding tests to #3920 I pushed some tests which would never fail, this fixes them

Proposed changes

Set a flag if the event failure is correctly caught. If not the test has actually failed, so we throw a new exception of our own.

Related Issues (if applicable)

Checklist

github-actions[bot] commented 11 months ago

Your Pull Request was automatically labelled as: "✨ Fix" Thank you for contributing to this project! ❤️

sonarcloud[bot] commented 11 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

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

See analysis details on SonarCloud

github-actions[bot] commented 11 months ago

Slimefun preview build

A Slimefun preview build is available for testing! Commit: 5e1334cb

https://preview-builds.walshy.dev/download/Slimefun/4054/5e1334cb

Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!

JustAHuman-xD commented 11 months ago

This works but ima check when I'm on my computer if there is a cleaner way to do this

JustAHuman-xD commented 7 months ago

(I may or may not have completely forgot about this, I'd say just go for it since nothing jumps out as better)

WalshyDev commented 7 months ago

Actually a much easier way to do this:

Assertions.assertThrows(
    AssertionError.class,
    () -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, e -> true)
);
JustAHuman-xD commented 7 months ago

Walshy chad moment

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

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

See analysis details on SonarCloud

Sfiguz7 commented 7 months ago

Oh wow, cool trick