### Question:
ImageCacheConfiguration extends Static { public static void setCacheMemorySize(String candidate) throws IllegalArgumentException{ try { Long.valueOf(candidate.substring(0, candidate.length() - 1)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid cache memory format : '"+candidate+"' should be formatted as <size>[g|G|m|M|k|K]"); } char unit = candidate.charAt(candidate.length()-1); if (Arrays.binarySearch(VALID_UNIT, unit) < 0) { throw new IllegalArgumentException("Invalid cache memory format : '"+candidate+"' should be formatted as <size>[g|G|m|M|k|K]"); } System.setProperty(KEY_CACHE_MEMORY_SIZE, candidate); }  static long getCacheMemorySize(); static void setCacheMemorySize(String candidate); static boolean isCacheSwapEnable(); static void setCacheSwapEnable(boolean allowSwap); static final String KEY_CACHE_MEMORY_SIZE; static final String KEY_CACHE_SWAP; }### Answer:
@Test public void writeMemorySize() { Properties properties = System.getProperties(); ImageCacheConfiguration.setCacheMemorySize("1g"); assertEquals("1g", properties.getProperty(ImageCacheConfiguration.KEY_CACHE_MEMORY_SIZE)); ImageCacheConfiguration.setCacheMemorySize("512m"); assertEquals("512m", properties.getProperty(ImageCacheConfiguration.KEY_CACHE_MEMORY_SIZE)); ImageCacheConfiguration.setCacheMemorySize("900k"); assertEquals("900k", properties.getProperty(ImageCacheConfiguration.KEY_CACHE_MEMORY_SIZE)); try { ImageCacheConfiguration.setCacheMemorySize("512"); fail(); } catch (IllegalArgumentException e) { } try { ImageCacheConfiguration.setCacheMemorySize("700Ko"); fail(); } catch (IllegalArgumentException e) { } try { ImageCacheConfiguration.setCacheMemorySize("1t"); fail(); } catch (IllegalArgumentException e) { } try { ImageCacheConfiguration.setCacheMemorySize("invalid"); fail(); } catch (IllegalArgumentException e) { } }