Fixed tests

This commit is contained in:
Florian CUNY 2019-01-20 10:00:17 +01:00
parent 819096eba9
commit 5a573bdbbe
3 changed files with 6 additions and 5 deletions

View File

@ -165,7 +165,7 @@ public class CycleClickTest {
when(flag.toPanelItem(Mockito.any(), Mockito.any())).thenReturn(panelItem);
when(panelItem.getItem()).thenReturn(mock(ItemStack.class));
FlagsManager fm = mock(FlagsManager.class);
when(fm.getFlagByID(Mockito.anyString())).thenReturn(flag);
when(fm.getFlag(Mockito.anyString())).thenReturn(Optional.of(flag));
when(plugin.getFlagsManager()).thenReturn(fm);
rm = mock(RanksManager.class);

View File

@ -4,6 +4,7 @@ import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Location;
@ -82,7 +83,7 @@ public class IslandToggleClickTest {
PanelItem item = mock(PanelItem.class);
when(item.getItem()).thenReturn(mock(ItemStack.class));
when(flag.toPanelItem(Mockito.any(), Mockito.eq(user))).thenReturn(item);
when(fm.getFlagByID(Mockito.anyString())).thenReturn(flag);
when(fm.getFlag(Mockito.anyString())).thenReturn(Optional.of(flag));
when(plugin.getFlagsManager()).thenReturn(fm);
// Island Manager

View File

@ -28,6 +28,8 @@ import world.bentobox.bentobox.managers.FlagsManager;
import world.bentobox.bentobox.managers.IslandWorldManager;
import world.bentobox.bentobox.util.Util;
import java.util.Optional;
@RunWith(PowerMockRunner.class)
@PrepareForTest({BentoBox.class, Util.class })
public class WorldToggleClickTest {
@ -72,9 +74,8 @@ public class WorldToggleClickTest {
PanelItem item = mock(PanelItem.class);
when(item.getItem()).thenReturn(mock(ItemStack.class));
when(flag.toPanelItem(Mockito.any(), Mockito.eq(user))).thenReturn(item);
when(fm.getFlagByID(Mockito.anyString())).thenReturn(flag);
when(fm.getFlag(Mockito.anyString())).thenReturn(Optional.of(flag));
when(plugin.getFlagsManager()).thenReturn(fm);
}
@Test
@ -99,5 +100,4 @@ public class WorldToggleClickTest {
Mockito.verify(flag).setSetting(Mockito.any(), Mockito.eq(true));
Mockito.verify(panel).getInventory();
}
}