### Question:
DataStatistics implements DebugSection { @Override public void execute(CommandSender sender, List<String> arguments) { sender.sendMessage(ChatColor.BLUE + "AuthMe statistics"); sender.sendMessage("LimboPlayers in memory: " + applyToLimboPlayersMap(limboService, Map::size)); sender.sendMessage("PlayerCache size: " + playerCache.getLogged() + " (= logged in players)"); outputDatabaseStats(sender); outputInjectorStats(sender); }  @Override String getName(); @Override String getDescription(); @Override void execute(CommandSender sender, List<String> arguments); @Override PermissionNode getRequiredPermission();  }### Answer:
@Test public void shouldOutputStatistics() { CommandSender sender = mock(CommandSender.class); given(singletonStore.retrieveAllOfType()).willReturn(mockListOfSize(Object.class, 7)); given(singletonStore.retrieveAllOfType(Reloadable.class)).willReturn(mockListOfSize(Reloadable.class, 4)); given(singletonStore.retrieveAllOfType(SettingsDependent.class)).willReturn(mockListOfSize(SettingsDependent.class, 3)); given(singletonStore.retrieveAllOfType(HasCleanup.class)).willReturn(mockListOfSize(HasCleanup.class, 2)); given(dataSource.getAccountsRegistered()).willReturn(219); given(playerCache.getLogged()).willReturn(12); dataStatistics.execute(sender, Collections.emptyList()); ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class); verify(sender, atLeastOnce()).sendMessage(stringCaptor.capture()); assertThat(stringCaptor.getAllValues(), containsInAnyOrder( ChatColor.BLUE + "AuthMe statistics", "Singleton Java classes: 7", "(Reloadable: 4 / SettingsDependent: 3 / HasCleanup: 2)", "LimboPlayers in memory: 1", "Total players in DB: 219", "PlayerCache size: 12 (= logged in players)")); }
@Test public void shouldOutputCachedDataSourceStatistics() { CacheDataSource cacheDataSource = mock(CacheDataSource.class); LoadingCache<String, Optional<PlayerAuth>> cache = mock(LoadingCache.class); given(cache.size()).willReturn(11L); given(cacheDataSource.getCachedAuths()).willReturn(cache); ReflectionTestUtils.setField(DataStatistics.class, dataStatistics, "dataSource", cacheDataSource); CommandSender sender = mock(CommandSender.class); dataStatistics.execute(sender, Collections.emptyList()); ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class); verify(sender, atLeastOnce()).sendMessage(stringCaptor.capture()); assertThat(stringCaptor.getAllValues(), hasItem("Cached PlayerAuth objects: 11")); }