### Question:
MemorySizeParser { public static long parse(String configuredMemorySize) throws IllegalArgumentException { MemorySize size = parseIncludingUnit(configuredMemorySize); return size.calculateMemorySizeInBytes(); }  static long parse(String configuredMemorySize);  }### Answer:
@Test public void testParse() { assertEquals(0, MemorySizeParser.parse("0")); assertEquals(0, MemorySizeParser.parse("")); assertEquals(0, MemorySizeParser.parse(null)); assertEquals(10, MemorySizeParser.parse("10")); assertEquals(4096, MemorySizeParser.parse("4k")); assertEquals(4096, MemorySizeParser.parse("4K")); assertEquals(16777216, MemorySizeParser.parse("16m")); assertEquals(16777216, MemorySizeParser.parse("16M")); assertEquals(2147483648L, MemorySizeParser.parse("2g")); assertEquals(2147483648L, MemorySizeParser.parse("2G")); assertEquals(3298534883328L, MemorySizeParser.parse("3t")); assertEquals(3298534883328L, MemorySizeParser.parse("3T")); }
@Test public void testParseErrors() { try { MemorySizeParser.parse("-1G"); Assert.fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { MemorySizeParser.parse("1000y"); Assert.fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } }