### Question:
DebugSectionUtils { static <U> U applyToLimboPlayersMap(LimboService limboService, Function<Map, U> function) { Field limboPlayerEntriesField = getLimboPlayerEntriesField(); if (limboPlayerEntriesField != null) { try { return function.apply((Map) limboEntriesField.get(limboService)); } catch (Exception e) { ConsoleLogger.logException("Could not retrieve LimboService values:", e); } } return null; } private  DebugSectionUtils();   }### Answer:
@Test public void shouldFetchMapInLimboService() { LimboService limboService = mock(LimboService.class); Map<String, LimboPlayer> limboMap = new HashMap<>(); ReflectionTestUtils.setField(LimboService.class, limboService, "entries", limboMap); Map map = DebugSectionUtils.applyToLimboPlayersMap(limboService, Function.identity()); assertThat(map, sameInstance(limboMap)); }
@Test public void shouldHandleErrorGracefully() { LimboService limboService = mock(LimboService.class); Map<String, LimboPlayer> limboMap = new HashMap<>(); ReflectionTestUtils.setField(LimboService.class, limboService, "entries", limboMap); Object result = DebugSectionUtils.applyToLimboPlayersMap(limboService, map -> { throw new IllegalStateException(); }); assertThat(result, nullValue()); }