Removed FlagsManager#getFlagByIcon() as it is useless

This commit is contained in:
Florian CUNY 2018-02-26 10:07:25 +01:00
parent e598fa7c93
commit c6c7e0b4ee
3 changed files with 0 additions and 21 deletions

View File

@ -70,14 +70,4 @@ public class FlagsManager {
public Flag getFlagByID(String id) { public Flag getFlagByID(String id) {
return flags.stream().filter(flag -> flag.getID().equals(id)).findFirst().orElse(null); return flags.stream().filter(flag -> flag.getID().equals(id)).findFirst().orElse(null);
} }
/**
* Get flag by icon
* @param icon material
* @return flag or null if it does not exist
*/
public Flag getFlagByIcon(Material icon) {
return flags.stream().filter(flag -> flag.getIcon().equals(icon)).findFirst().orElse(null);
}
} }

View File

@ -520,7 +520,6 @@ public class TestBSkyBlock {
// Add it to the Flag Manager // Add it to the Flag Manager
flagsManager.registerFlag(customFlag); flagsManager.registerFlag(customFlag);
assertEquals(customFlag, flagsManager.getFlagByID("CUSTOM_FLAG")); assertEquals(customFlag, flagsManager.getFlagByID("CUSTOM_FLAG"));
assertEquals(customFlag, flagsManager.getFlagByIcon(customFlag.getIcon()));
} }
/** /**

View File

@ -104,14 +104,4 @@ public class FlagsManagerTest {
Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByID(flag.getID()))); Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByID(flag.getID())));
} }
@Test
public void testGetFlagByIcon() {
BSkyBlock plugin = mock(BSkyBlock.class);
FlagsManager fm = new FlagsManager(plugin);
// Test in forward and reverse order so that any duplicates are caught
Flags.values().stream().sorted().forEach(flag -> assertEquals(flag, fm.getFlagByIcon(flag.getIcon())));
Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByIcon(flag.getIcon())));
}
} }