@Test
public void testHasPermissionCachesValues() {

    MockMinecraftAPI api = new MockMinecraftAPI();
    // Set the ticker elapsed time to be 0, so all answers are cached.
    BukkitPlayer bukkitPlayer =
            new BukkitPlayer(UUID.randomUUID(), api, ticker);
    // Test a simple permission
    api.permReturnValue = Boolean.TRUE;
    assertTrue(bukkitPlayer.hasPermission("TestTrue"));
    // Ensure that the value is cached
    api.permReturnValue = Boolean.FALSE;
    assertTrue(bukkitPlayer.hasPermission("TestTrue"));
    // Now trigger a cache reset and ensure the value has been updated
    api.permReturnValue = Boolean.FALSE;
    ticker.setElapsed(TimeUnit.SECONDS.toNanos(BukkitPlayer.MAX_CACHE_AGE_SECS + 1));
    assertFalse(bukkitPlayer.hasPermission("TestTrue"));
}