### Question:
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);  }### Answer:
@Test public void testGetExecutor() { final CclExecutor executor = mock(CclExecutor.class); @SuppressWarnings("unchecked") final Enumeration<CclExecutor> executorEnum = mock(Enumeration.class); when(executorEnum.hasMoreElements()).thenReturn(Boolean.TRUE); when(executorEnum.nextElement()).thenReturn(executor); mockStatic(Service.class); when(Service.providers(CclExecutor.class)).thenReturn(executorEnum); assertThat(CclExecutor.getExecutor()).isEqualTo(executor); }
@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()); }