BitmapEncoderRegistry { public static BitmapEncoder getInstance(String mime) { for (final Entry entry : encoders) { final BitmapEncoder encoder = entry.encoder; if (supports(encoder, mime)) { return encoder; } } throw new UnsupportedOperationException( "No BitmapEncoder available for " + mime); } private  BitmapEncoderRegistry(); static void register(String classname, int priority); static boolean supports(BitmapEncoder encoder, String mime); static boolean supports(String mime); static BitmapEncoder getInstance(String mime); static Set<String> getSupportedMIMETypes();  }
@Test public void testGetInstance() { System.out.println("getInstance"); String mime = "image/gif"; BitmapEncoder result = BitmapEncoderRegistry.getInstance(mime); assertNotNull(result); try { BitmapEncoderRegistry.getInstance("foo/app"); fail("no instance should beavailable"); } catch (UnsupportedOperationException e) { } }