@Test public void testGetExecutorNoProviders() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> executorEnum = mock(Enumeration.class); when(executorEnum.hasMoreElements()).thenReturn(Boolean.FALSE); mockStatic(Service.class); when(Service.providers(CclExecutor.class)).thenReturn(executorEnum); IllegalStateException e = assertThrows(IllegalStateException.class, () -> { CclExecutor.getExecutor(); }); assertThat(e.getMessage()).isEqualTo("No implementations found of: " + CclExecutor.class.getName()); }
public static CclExecutor getExecutor() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> providers = Service.providers(CclExecutor.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclExecutor.class.getName()); return providers.nextElement(); }
CclExecutor { public static CclExecutor getExecutor() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> providers = Service.providers(CclExecutor.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclExecutor.class.getName()); return providers.nextElement(); } }
CclExecutor { public static CclExecutor getExecutor() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> providers = Service.providers(CclExecutor.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclExecutor.class.getName()); return providers.nextElement(); }  }
CclExecutor { public static CclExecutor getExecutor() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> providers = Service.providers(CclExecutor.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclExecutor.class.getName()); return providers.nextElement(); }  static CclExecutor getExecutor(); @SuppressWarnings("rawtypes") abstract DynamicCompilerAdder addDynamicCompiler(File includeFile); @SuppressWarnings("rawtypes") abstract ScriptCompilerAdder addScriptCompiler(File file); abstract ScriptDropAdder addScriptDropper(String scriptName); abstract ScriptExecutionAdder addScriptExecution(String scriptName); abstract void execute(); abstract void setOutputStream(OutputStream stream, OutputType outputType); abstract void setTerminalProperties(TerminalProperties terminalProperties); }
CclExecutor { public static CclExecutor getExecutor() { @SuppressWarnings("unchecked") final Enumeration<CclExecutor> providers = Service.providers(CclExecutor.class); if (!providers.hasMoreElements()) throw new IllegalStateException("No implementations found of: " + CclExecutor.class.getName()); return providers.nextElement(); }  static CclExecutor getExecutor(); @SuppressWarnings("rawtypes") abstract DynamicCompilerAdder addDynamicCompiler(File includeFile); @SuppressWarnings("rawtypes") abstract ScriptCompilerAdder addScriptCompiler(File file); abstract ScriptDropAdder addScriptDropper(String scriptName); abstract ScriptExecutionAdder addScriptExecution(String scriptName); abstract void execute(); abstract void setOutputStream(OutputStream stream, OutputType outputType); abstract void setTerminalProperties(TerminalProperties terminalProperties);  }