@Test public void testGetUploader() { final CclResourceUploader uploader = mock(CclResourceUploader.class); @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> uploaders = mock(Enumeration.class); when(uploaders.hasMoreElements()).thenReturn(Boolean.TRUE, Boolean.FALSE); when(uploaders.nextElement()).thenReturn(uploader); mockStatic(Service.class); when(Service.providers(CclResourceUploader.class)).thenReturn(uploaders); assertThat(CclResourceUploader.getUploader()).isEqualTo(uploader); }
public static CclResourceUploader getUploader() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> providers = Service.providers(CclResourceUploader.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclResourceUploader.class.getName()); return providers.nextElement(); }
CclResourceUploader { public static CclResourceUploader getUploader() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> providers = Service.providers(CclResourceUploader.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclResourceUploader.class.getName()); return providers.nextElement(); } }
CclResourceUploader { public static CclResourceUploader getUploader() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> providers = Service.providers(CclResourceUploader.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclResourceUploader.class.getName()); return providers.nextElement(); }  }
CclResourceUploader { public static CclResourceUploader getUploader() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> providers = Service.providers(CclResourceUploader.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclResourceUploader.class.getName()); return providers.nextElement(); }  static CclResourceUploader getUploader(); abstract void queueUpload(File file); abstract Map<File, URI> upload(); }
CclResourceUploader { public static CclResourceUploader getUploader() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> providers = Service.providers(CclResourceUploader.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclResourceUploader.class.getName()); return providers.nextElement(); }  static CclResourceUploader getUploader(); abstract void queueUpload(File file); abstract Map<File, URI> upload();  }