Slimefun4
Slimefun4 copied to clipboard
Actually check if the negative tests do their job
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
- [ ] I have fully tested the proposed changes and promise that they will not break everything into chaos.
- [ ] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
- [ ] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
- [x] I followed the existing code standards and didn't mess up the formatting.
- [ ] I did my best to add documentation to any public classes or methods I added.
- [ ] I have added
NonnullandNullableannotations to my methods to indicate their behaviour for null values - [x] I added sufficient Unit Tests to cover my code.
Your Pull Request was automatically labelled as: "✨ Fix" Thank you for contributing to this project! ❤️
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
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!
This works but ima check when I'm on my computer if there is a cleaner way to do this
(I may or may not have completely forgot about this, I'd say just go for it since nothing jumps out as better)
Actually a much easier way to do this:
Assertions.assertThrows(
AssertionError.class,
() -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, e -> true)
);
Walshy chad moment
Quality Gate passed
Issues
5 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Oh wow, cool trick