### Question:
PluginHookService { public void setEssentialsSocialSpyStatus(Player player, boolean socialSpyStatus) { if (essentials != null) { essentials.getUser(player).setSocialSpyEnabled(socialSpyStatus); } } @Inject  PluginHookService(PluginManager pluginManager); void setEssentialsSocialSpyStatus(Player player, boolean socialSpyStatus); File getEssentialsDataFolder(); File getCmiDataFolder(); Location getMultiverseSpawn(World world); boolean isEssentialsAvailable(); boolean isCmiAvailable(); boolean isMultiverseAvailable(); void tryHookToEssentials(); void tryHookToCmi(); void tryHookToMultiverse(); void unhookEssentials(); void unhookCmi(); void unhookMultiverse();  }### Answer:
@Test public void shouldSetSocialSpyStatus() { Player player = mock(Player.class); Essentials ess = mock(Essentials.class); User user = mock(User.class); given(ess.getUser(player)).willReturn(user); PluginManager pluginManager = mock(PluginManager.class); setPluginAvailable(pluginManager, ESSENTIALS, ess); PluginHookService pluginHookService = new PluginHookService(pluginManager); pluginHookService.setEssentialsSocialSpyStatus(player, true); verify(ess).getUser(player); verify(user).setSocialSpyEnabled(true); }
@Test public void shouldNotDoAnythingForUnhookedEssentials() { PluginHookService pluginHookService = new PluginHookService(mock(PluginManager.class)); pluginHookService.setEssentialsSocialSpyStatus(mock(Player.class), false); }