### Question:
CacheManager implements CacheManagerBean { long resolveDefaultMaxSize() { if (resolvedMaxCacheSize != -1) { return resolvedMaxCacheSize; } final String maximumSizeSystemPropertyArg = getMaximumSizeSystemProperty(); final String maximumSizeEnvVariableArg = getMaximumSizeEnvVariable(); long maxCacheSize = -1L; { long maximumSizeSystemProperty; try { maximumSizeSystemProperty = parseCacheSizeArgument(maximumSizeSystemPropertyArg); if (maximumSizeSystemProperty > -1L) { LOG.info(String.format( "Configuring GeoGig shared object cache maximum size to %,d bytes as given by the System property GEOGIG_CACHE_MAX_SIZE=%s", maximumSizeSystemProperty, maximumSizeSystemPropertyArg)); maxCacheSize = maximumSizeSystemProperty; } } catch (IllegalArgumentException e) { if (isNullOrEmpty(maximumSizeEnvVariableArg)) { LOG.warn("Unable to parse System property {}={}. Falling back to default value", GEOGIG_CACHE_MAX_SIZE, maximumSizeSystemPropertyArg, e); } else { LOG.warn( "Unable to parse System property {}={}. Falling back to environment variable", GEOGIG_CACHE_MAX_SIZE, maximumSizeSystemPropertyArg, e); } } } if (maxCacheSize == -1L) { long maximumSizeEnvVariable; try { maximumSizeEnvVariable = parseCacheSizeArgument(maximumSizeEnvVariableArg); if (maximumSizeEnvVariable > -1L) { LOG.info(String.format( "Configuring GeoGig shared object cache maximum size to %,d bytes as given by the environment variable GEOGIG_CACHE_MAX_SIZE=%s", maximumSizeEnvVariable, maximumSizeEnvVariableArg)); maxCacheSize = maximumSizeEnvVariable; } } catch (IllegalArgumentException e) { LOG.warn("Unable to parse environment variable {}={}", GEOGIG_CACHE_MAX_SIZE, maximumSizeEnvVariableArg, e); } } if (maxCacheSize != -1L) { long absoluteMaxCacheSize = getAbsoluteMaximumSize(); if (absoluteMaxCacheSize < maxCacheSize) { LOG.warn("cache size is too big: {}, maximum allowed: {}", maxCacheSize, absoluteMaxCacheSize); maxCacheSize = -1L; } } if (maxCacheSize == -1L) { final double percent = DEFAULT_CACHE_SIZE_PERCENT; maxCacheSize = getCacheSizePercent(percent); LOG.info(String.format( "Configuring GeoGig shared object cache maximum size to the default of %,d bytes " + "as given by the default %f percent of available heap. Use the GEOGIG_CACHE_MAX_SIZE System property or environment" + "variable to set a different maximum size at runtime", maxCacheSize, percent)); } return maxCacheSize; } @VisibleForTesting  CacheManager(); void setEncoder(@NonNull RevObjectSerializer encoder); ObjectCache acquire(final @NonNull String uniqueCacheIdentifier); void release(ObjectCache cache); @Override long getSize(); @Override long getSizeBytes(); @Override double getSizeMB(); @Override void clear(); @Override long getHitCount(); @Override double getHitRate(); @Override long getMissCount(); @Override double getMissRate(); @Override long getEvictionCount(); @Override void setMaximumSizePercent(double percent); @Override void setMaximumSizeMB(double maxSizeMB); long getMaximumSize(); @Override double getMaximumSizeMB(); @Override void setMaximumSize(long maxSizeBytes); @Override double getMaximumSizePercent(); @Override double getDefaultSizeMB(); @Override double getAbsoluteMaximumSizeMB(); @Nullable @Override String getMaximumSizeSystemProperty(); @Nullable @Override String getMaximumSizeEnvVariable(); @Nullable @Override String getCacheImplementationName(); static final CacheManager INSTANCE; static final String ENV_VAR; }### Answer:
public @Test void resolveDefaultMaxSize() { doReturn(null).when(cacheManager).getMaximumSizeSystemProperty(); doReturn(null).when(cacheManager).getMaximumSizeEnvVariable(); assertDefaultMaxSizeDefaultValue(); }