use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.
the class PartiesPlaceholderTest method testPlaceholderTag.
@Test
public void testPlaceholderTag() {
PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("tag");
assertEquals(PartiesPlaceholder.TAG, placeholder);
assertEquals("", placeholder.formatPlaceholder(player1, party1, ""));
party1.setAccessible(true);
party1.setTag("tag");
party1.setAccessible(false);
assertEquals(party1.getTag(), placeholder.formatPlaceholder(player1, party1, ""));
}
use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.
the class PartiesPlaceholderTest method testPlaceholderKills.
@Test
public void testPlaceholderKills() {
PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("kills");
assertEquals(PartiesPlaceholder.KILLS, placeholder);
assertEquals("0", placeholder.formatPlaceholder(player1, party1, "kills"));
party1.setAccessible(true);
party1.setKills(100);
party1.setAccessible(false);
assertEquals(Integer.toString(party1.getKills()), placeholder.formatPlaceholder(player1, party1, "kills"));
}
use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.
the class PartiesPlaceholderTest method testPlaceholderPlayerNickname.
@Test
public void testPlaceholderPlayerNickname() {
ConfigParties.ADDITIONAL_NICKNAME_FORMAT = "~%nickname%";
PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("player_nickname");
assertEquals(PartiesPlaceholder.PLAYER_NICKNAME, placeholder);
assertEquals(player1.getName(), placeholder.formatPlaceholder(player1, party1, ""));
player1.setAccessible(true);
player1.setNickname("newNickname");
player1.setAccessible(false);
assertEquals("~" + player1.getNickname(), placeholder.formatPlaceholder(player1, party1, ""));
}
use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.
the class PartiesPlaceholderTest method testNullness.
@Test
public void testNullness() {
PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("impossible_placeholder");
assertNull(placeholder);
}
use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.
the class PartiesPlaceholderTest method testPlaceholderListRank.
@Test
public void testPlaceholderListRank() {
RankManager mockRankManager = mock(RankManager.class);
when(mockPlugin.getRankManager()).thenReturn(mockRankManager);
when(mockRankManager.searchRankByHardName(any())).thenReturn(new PartyRankImpl("myrank", "myrank", "", 20, 0, null, Collections.emptyList(), true));
when(mockMessageUtils.convertPlaceholders(any(), any(), any())).thenReturn("Dummy");
PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank");
assertEquals(PartiesPlaceholder.LIST_RANK, placeholder);
assertEquals(player1.getName(), placeholder.formatPlaceholder(null, party1, "list_rank_myrank"));
placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_total");
assertEquals(PartiesPlaceholder.LIST_RANK_TOTAL, placeholder);
placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_1");
assertEquals(PartiesPlaceholder.LIST_RANK_NUMBER, placeholder);
placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_1_placeholder");
assertEquals(PartiesPlaceholder.LIST_RANK_NUMBER_PLACEHOLDER, placeholder);
}
Aggregations