Skip to content

Commit

Permalink
Fix failing Tests.
Browse files Browse the repository at this point in the history
These tests failed because in I added Server version check in ChallengesAddon class.
  • Loading branch information
BONNe committed May 24, 2019
1 parent 330034e commit deab2d3
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ 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);
when(user.getInventory()).thenReturn(inv);
addon = mock(ChallengesAddon.class);
required = new ArrayList<>();

Server server = mock(Server.class);
ItemFactory itemFactory = mock(ItemFactory.class);
when(server.getItemFactory()).thenReturn(itemFactory);

// Test will not work with items that has meta data.
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());
}
Expand Down

0 comments on commit deab2d3

Please sign in to comment.