StandardQuotaStrategy implements QuotaManagerStrategy, UsageTracker { public void setMaxFileSizeMB(int maxFileSizeMB) { this.maxFileSizeMB = maxFileSizeMB; }  void init(); void shutdown(); @Override boolean beforeWritingCacheFile(long contentSizeBytes); @Override boolean afterWritingCacheFile(long contentSizeBytes); void setMaxUsageMB(long maxUsageMB); void setMaxUsageBytes(long maxUsageBytes); void setPanicThresholdPct(int panicThresholdPct); void setCleanThresholdPct(int cleanThresholdPct); @Required void setCache(ContentCacheImpl cache); @Required void setCleaner(CachedContentCleaner cleaner); @Override long getCurrentUsageBytes(); double getCurrentUsageMB(); long getMaxUsageBytes(); long getMaxUsageMB(); int getMaxFileSizeMB(); void setMaxFileSizeMB(int maxFileSizeMB); @Override long addUsageBytes(long sizeDelta); @Override void setCurrentUsageBytes(long newDiskUsage);  }
@SuppressWarnings("unchecked") @Test public void largeContentCacheFilesAreNotKeptOnDisk() throws IOException { quota.setMaxFileSizeMB(3); writeSingleFileInMB(1); writeSingleFileInMB(2); writeSingleFileInMB(3); writeSingleFileInMB(4); List<File> files = new ArrayList<File>(findCacheFiles()); assertEquals(3, files.size()); Collections.sort(files,SizeFileComparator.SIZE_COMPARATOR); assertEquals(1, files.get(0).length() / FileUtils.ONE_MB); assertEquals(2, files.get(1).length() / FileUtils.ONE_MB); assertEquals(3, files.get(2).length() / FileUtils.ONE_MB); }