### Question:
ContaineredTaskManagerParameters implements java.io.Serializable { public static long calculateCutoffMB(Configuration config, long containerMemoryMB) { Preconditions.checkArgument(containerMemoryMB > 0); final float memoryCutoffRatio = config.getFloat( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO); if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given=" + memoryCutoffRatio); } final int minCutoff = config.getInteger( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN); if (minCutoff >= containerMemoryMB) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff + "' is larger than the total container memory " + containerMemoryMB); } long cutoff = (long) (containerMemoryMB * memoryCutoffRatio); if (cutoff < minCutoff) { cutoff = minCutoff; } return cutoff; } ContaineredTaskManagerParameters(
			long totalContainerMemoryMB,
			long taskManagerHeapSizeMB,
			long taskManagerDirectMemoryLimitMB,
			int numSlots,
			HashMap<String, String> taskManagerEnv); long taskManagerTotalMemoryMB(); long taskManagerHeapSizeMB(); long taskManagerDirectMemoryLimitMB(); int numSlots(); Map<String, String> taskManagerEnv(); @Override String toString(); static long calculateCutoffMB(Configuration config, long containerMemoryMB); static ContaineredTaskManagerParameters create(
			Configuration config,
			long containerMemoryMB,
			int numSlots);  }### Answer:
@Test public void testCalculateCutoffMB() { Configuration config = new Configuration(); long containerMemoryMB = 1000L; config.setFloat(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO, 0.1f); config.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 128); assertEquals(128, ContaineredTaskManagerParameters.calculateCutoffMB(config, containerMemoryMB)); config.setFloat(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO, 0.2f); assertEquals(200, ContaineredTaskManagerParameters.calculateCutoffMB(config, containerMemoryMB)); config.setInteger(ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN, 1000); try { ContaineredTaskManagerParameters.calculateCutoffMB(config, containerMemoryMB); fail("Expected to fail with an invalid argument exception."); } catch (IllegalArgumentException ignored) { } }