ImageDB { public ImageSize getImageSize(long imageID) { ImageSize result = null; lock.readLock().lock(); try { result = sizes.getOrDefault(imageID, null); } finally { lock.readLock().unlock(); } return result; } ImageDB();  ImageDB(ImageDB copy); boolean hasImageID(ImageDBKey imageKey, ImageSize imageSize); boolean hasImageID(long productID, ImageSize imageSize); boolean hasImageID(String name, ImageSize imageSize); long getImageID(ImageDBKey imageKey, ImageSize imageSize); long getImageID(long productID, ImageSize imageSize); long getImageID(String name, ImageSize imageSize); ImageSize getImageSize(long imageID); void setImageMapping(ImageDBKey imageKey, long imageID, ImageSize imageSize); void setImageMapping(long productID, long imageID, ImageSize imageSize); void setImageMapping(String name, long imageID, ImageSize imageSize); void removeImageMapping(long imageID);  }
@Test public void testGetImageSize() { assertNull(uut.getImageSize(PRODUCT_IMAGE_ID)); uut.setImageMapping(mockedProductKey, PRODUCT_IMAGE_ID, size); assertNull(uut.getImageSize(NAME_IMAGE_ID)); assertEquals(size, uut.getImageSize(PRODUCT_IMAGE_ID)); uut.setImageMapping(mockedProductKey, PRODUCT_IMAGE_ID_LARGE, sizeLarge); assertNull(uut.getImageSize(NAME_IMAGE_ID)); assertNotEquals(sizeLarge, uut.getImageSize(PRODUCT_IMAGE_ID)); assertEquals(size, uut.getImageSize(PRODUCT_IMAGE_ID)); }