### Question:
PluginHookService { public File getEssentialsDataFolder() { if (essentials != null) { return essentials.getDataFolder(); } return null; } @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 shouldReturnEssentialsDataFolder() { Essentials ess = mock(Essentials.class); File essDataFolder = new File("test/data-folder"); ReflectionTestUtils.setField(JavaPlugin.class, ess, "dataFolder", essDataFolder); PluginManager pluginManager = mock(PluginManager.class); setPluginAvailable(pluginManager, ESSENTIALS, ess); PluginHookService pluginHookService = new PluginHookService(pluginManager); File dataFolder = pluginHookService.getEssentialsDataFolder(); assertThat(dataFolder, equalTo(essDataFolder)); }
@Test public void shouldReturnNullForUnhookedEssentials() { PluginManager pluginManager = mock(PluginManager.class); PluginHookService pluginHookService = new PluginHookService(pluginManager); File result = pluginHookService.getEssentialsDataFolder(); assertThat(result, nullValue()); }