ImageDB { public boolean hasImageID(ImageDBKey imageKey, ImageSize imageSize) { if (imageKey == null) { log.error("The supplied image key is null."); throw new NullPointerException("The supplied image key is null."); } if (imageKey.isProductKey()) { return hasImageID(imageKey.getProductID(), imageSize); } return hasImageID(imageKey.getWebUIName(), imageSize); } 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 testHasImageID() { uut.setImageMapping(mockedProductKey, PRODUCT_IMAGE_ID, size); assertTrue(uut.hasImageID(mockedProductKey, size)); assertFalse(uut.hasImageID(mockedNameKey, size)); uut = new ImageDB(); uut.setImageMapping(mockedNameKey, NAME_IMAGE_ID, size); assertTrue(uut.hasImageID(mockedNameKey, size)); assertFalse(uut.hasImageID(mockedProductKey, size)); }
@Test(expected = NullPointerException.class) public void testHasImageIDNull() { uut.hasImageID((ImageDBKey) null, size); }