Skip to content

Commit

Permalink
test: fix bukkit view connector test
Browse files Browse the repository at this point in the history
  • Loading branch information
Silthus committed Feb 26, 2022
1 parent 792d99f commit 777001b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ protected SChatBukkitServer sChat() {

@SuppressWarnings("SameParameterValue")
protected void assertLastMessageIs(ConsoleCommandSenderMock mock, String message) {
assertTrimmedEquals(getLastMessage(mock::nextMessage), message);
assertTrimmedEquals(lastMessage(mock::nextMessage), message);
}

@SuppressWarnings("SameParameterValue")
protected void assertLastMessageIs(PlayerMock player, String message) {
assertTrimmedEquals(getLastMessage(player::nextMessage), message);
assertTrimmedEquals(lastMessage(player::nextMessage), message);
}

protected void assertLastMessageContains(PlayerMock player, String text) {
assertTrimmedContains(getLastMessage(player::nextMessage), text);
assertTrimmedContains(lastMessage(player::nextMessage), text);
}

@Nullable
private String getLastMessage(Supplier<String> nextMessageSupplier) {
private String lastMessage(Supplier<String> nextMessageSupplier) {
String nextMessage;
String lastMessage = null;
while ((nextMessage = nextMessageSupplier.get()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.junit.jupiter.api.Test;

import static net.kyori.adventure.text.Component.text;
import static net.silthus.schat.message.Message.message;
import static org.assertj.core.api.Assertions.assertThat;

class BukkitChatterFactoryTests extends BukkitTests {
Expand Down Expand Up @@ -85,7 +84,7 @@ void given_player_changes_display_name_then_chatter_name_changes() {
@Nested class when_message_is_send {
@BeforeEach
void setUp() {
message("Hey").to(createChatter()).send();
createChatter().sendRawMessage(text("Hey"));
}

@Test
Expand Down

0 comments on commit 777001b

Please sign in to comment.