Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerChatTabCompleteEventTest.java
1 package org.bukkit.event;
2 
3 import static org.hamcrest.CoreMatchers.is;
4 import static org.junit.Assert.assertThat;
5 
8 import org.junit.Test;
9 
10 import com.google.common.collect.ImmutableList;
11 
13 
14  @Test
15  public void testGetLastToken() {
16  assertThat(getToken("Hello everyone!"), is("everyone!"));
17  assertThat(getToken(" welcome to the show..."), is("show..."));
18  assertThat(getToken("The whitespace is here "), is(""));
19  assertThat(getToken("Too much whitespace is here "), is(""));
20  assertThat(getToken("The_whitespace_is_missing"), is("The_whitespace_is_missing"));
21  assertThat(getToken(""), is(""));
22  assertThat(getToken(" "), is(""));
23  }
24 
25  private String getToken(String message) {
26  return new PlayerChatTabCompleteEvent(TestPlayer.getInstance(), message, ImmutableList.<String>of()).getLastToken();
27  }
28 }