@Test public void testGetUploaderNoImplementation() { @SuppressWarnings("unchecked") final Enumeration<CclResourceUploader> uploaders = mock(Enumeration.class); mockStatic(Service.class); when(Service.providers(CclResourceUploader.class)).thenReturn(uploaders); IllegalStateException e = assertThrows(IllegalStateException.class, () -> { CclResourceUploader.getUploader(); }); assertThat(e.getMessage()).isEqualTo("No implementations found of: " + CclResourceUploader.class.getName()); }
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();  }