### Question:
MemoryUsage extends Usage<MemoryUsage> { public void setPercentOfJvmHeap(int percentOfJvmHeap) { if (percentOfJvmHeap > 0) { setLimit(Math.round(Runtime.getRuntime().maxMemory() * percentOfJvmHeap / 100.0)); } } MemoryUsage();  MemoryUsage(MemoryUsage parent);  MemoryUsage(String name);  MemoryUsage(MemoryUsage parent, String name);  MemoryUsage(MemoryUsage parent, String name, float portion); @Override void waitForSpace(); @Override boolean waitForSpace(long timeout); @Override boolean isFull(); void enqueueUsage(long value); void increaseUsage(long value); void decreaseUsage(long value); @Override long getUsage(); void setUsage(long usage); void setPercentOfJvmHeap(int percentOfJvmHeap);  }### Answer:
@Test public void testPercentOfJvmHeap() throws Exception { underTest.setPercentOfJvmHeap(50); assertEquals("limit is half jvm limit", Math.round(Runtime.getRuntime().maxMemory() / 2.0), underTest.getLimit()); }