public long computeExpirationTime(final String pHttpExpiresHeader, final String pHttpCacheControlHeader, final long pNow) {
        final Long override = Configuration.getInstance().getExpirationOverrideDuration();
        if (override != null) {
            return pNow + override;
        }

        final long extension = Configuration.getInstance().getExpirationExtendedDuration();
        final Long cacheControlDuration = getHttpCacheControlDuration(pHttpCacheControlHeader);
        if (cacheControlDuration != null) {
            return pNow + cacheControlDuration * 1000 + extension;
        }

        final Long httpExpiresTime = getHttpExpiresTime(pHttpExpiresHeader);
        if (httpExpiresTime != null) {
            return httpExpiresTime + extension;
        }

        return pNow + OpenStreetMapTileProviderConstants.DEFAULT_MAXIMUM_CACHED_FILE_AGE + extension;
    }
@Test
    public void testComputeExpirationTime() {
        final Random random = new Random();
        final int oneWeek = 7 * 24 * 3600 * 1000; // 7 days in milliseconds
        testComputeExpirationTimeHelper(null, random.nextInt(oneWeek));
        testComputeExpirationTimeHelper((long) random.nextInt(oneWeek), random.nextInt(oneWeek));
    }