Fix failing Tests.

These tests failed because in I added Server version check in ChallengesAddon class.
This commit is contained in:
BONNe 2019-05-24 09:39:40 +03:00
parent 330034ea8e
commit deab2d3530
1 changed files with 5 additions and 4 deletions

View File

@ -56,6 +56,11 @@ public class TryToCompleteTest {
*/
@Before
public void setUp() throws Exception {
Server server = mock(Server.class);
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getBukkitVersion()).thenReturn("1.13.2");
user = mock(User.class);
inv = mock(PlayerInventory.class);
when(inv.getContents()).thenReturn(stacks);
@ -63,7 +68,6 @@ public class TryToCompleteTest {
addon = mock(ChallengesAddon.class);
required = new ArrayList<>();
Server server = mock(Server.class);
ItemFactory itemFactory = mock(ItemFactory.class);
when(server.getItemFactory()).thenReturn(itemFactory);
@ -71,9 +75,6 @@ public class TryToCompleteTest {
when(itemFactory.getItemMeta(any())).thenReturn(null);
when(itemFactory.equals(null, null)).thenReturn(true);
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
}