Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Sep 11, 2021
1 parent 646cd4f commit 950a95c
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public void setUp() throws Exception {
when(plugin.getIWM()).thenReturn(iwm);
when(iwm.getAddon(any())).thenReturn(Optional.of(gma));
list = new ArrayList<>();
list.add("AXOLOTL");
list.add("BAT");
list.add("COW");
when(iwm.getMobLimitSettings(any())).thenReturn(list);
Expand All @@ -104,23 +103,19 @@ public void tearDown() {
public void testOnClick() {
GeoMobLimitTab tab = new GeoMobLimitTab(user, EntityLimitTabType.GEO_LIMIT, world);
// AXOLOTL, BAT, and COW in list
assertEquals(3, list.size());
assertEquals("COW", list.get(2));
assertEquals("BAT", list.get(1));
assertEquals("AXOLOTL", list.get(0));

// Click on AXOLOTL
tab.onClick(panel, user, ClickType.LEFT, 9);
list.forEach(System.out::println);
assertEquals(2, list.size());
assertEquals("COW", list.get(1));
assertEquals("BAT", list.get(0));
// Click on AXOLOTL again to have it added

// Click on BAT
tab.onClick(panel, user, ClickType.LEFT, 9);
assertEquals(3, list.size());
assertEquals("BAT", list.get(0));
assertEquals("COW", list.get(1));
assertEquals("AXOLOTL", list.get(2));
assertEquals(1, list.size());
assertEquals("COW", list.get(0));
// Click on BAT again to have it added
tab.onClick(panel, user, ClickType.LEFT, 9);
assertEquals(2, list.size());
assertEquals("COW", list.get(0));
assertEquals("BAT", list.get(1));
verify(gma, times(2)).saveWorldSettings();
}

Expand Down

0 comments on commit 950a95c

Please sign in to comment.