mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Change to 3.0.0
This commit is contained in:
parent
6a1561a507
commit
d339edfe21
2
pom.xml
2
pom.xml
@ -84,7 +84,7 @@
|
|||||||
<!-- Do not change unless you want different name for local builds. -->
|
<!-- Do not change unless you want different name for local builds. -->
|
||||||
<build.number>-LOCAL</build.number>
|
<build.number>-LOCAL</build.number>
|
||||||
<!-- This allows to change between versions. -->
|
<!-- This allows to change between versions. -->
|
||||||
<build.version>2.7.1</build.version>
|
<build.version>3.0.0</build.version>
|
||||||
<sonar.organization>bentobox-world</sonar.organization>
|
<sonar.organization>bentobox-world</sonar.organization>
|
||||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||||
<server.jars>${project.basedir}/lib</server.jars>
|
<server.jars>${project.basedir}/lib</server.jars>
|
||||||
|
@ -241,42 +241,6 @@ public abstract class AbstractCommonSetup {
|
|||||||
checkSpigotMessage(expectedMessage, 1);
|
checkSpigotMessage(expectedMessage, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public void checkSpigotMessage(String expectedMessage, boolean shouldBePresent) {
|
|
||||||
// Capture the argument passed to spigot().sendMessage(...) if messages are sent
|
|
||||||
ArgumentCaptor<TextComponent> captor = ArgumentCaptor.forClass(TextComponent.class);
|
|
||||||
|
|
||||||
if (shouldBePresent) {
|
|
||||||
// If we expect a message to be present, verify that sendMessage() was called at least once
|
|
||||||
verify(spigot, atLeastOnce()).sendMessage(captor.capture());
|
|
||||||
|
|
||||||
// Get all captured TextComponents
|
|
||||||
List<TextComponent> capturedMessages = captor.getAllValues();
|
|
||||||
|
|
||||||
// Check if any captured message contains the expected text
|
|
||||||
boolean messageFound = capturedMessages.stream()
|
|
||||||
.map(component -> component.toPlainText()) // Convert each TextComponent to plain text
|
|
||||||
.anyMatch(messageText -> messageText.contains(expectedMessage)); // Check if the expected message is present
|
|
||||||
|
|
||||||
// Assert that the message was found
|
|
||||||
assertTrue("Expected message not found: " + expectedMessage, messageFound);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// If we expect no messages with this text, capture any sent messages to ensure none match the given message
|
|
||||||
verify(spigot, atLeast(0)).sendMessage(captor.capture());
|
|
||||||
|
|
||||||
// Get all captured TextComponents
|
|
||||||
List<TextComponent> capturedMessages = captor.getAllValues();
|
|
||||||
|
|
||||||
// Check that none of the captured messages contain the forbidden text
|
|
||||||
boolean messageFound = capturedMessages.stream().map(component -> component.toPlainText()) // Convert each TextComponent to plain text
|
|
||||||
.anyMatch(messageText -> messageText.contains(expectedMessage)); // Check if the message is present
|
|
||||||
|
|
||||||
// Assert that the message was NOT found
|
|
||||||
assertFalse("Unexpected message found: " + expectedMessage, messageFound);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void checkSpigotMessage(String expectedMessage, int expectedOccurrences) {
|
public void checkSpigotMessage(String expectedMessage, int expectedOccurrences) {
|
||||||
// Capture the argument passed to spigot().sendMessage(...) if messages are sent
|
// Capture the argument passed to spigot().sendMessage(...) if messages are sent
|
||||||
ArgumentCaptor<TextComponent> captor = ArgumentCaptor.forClass(TextComponent.class);
|
ArgumentCaptor<TextComponent> captor = ArgumentCaptor.forClass(TextComponent.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user