List of usage examples for java.util.concurrent AbstractExecutorService AbstractExecutorService
AbstractExecutorService
From source file:Main.java
public static ExecutorService immediateExecutorService() { return new AbstractExecutorService() { @Override// w ww . ja v a 2s . c om public void shutdown() { } @Override public List<Runnable> shutdownNow() { return null; } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public boolean awaitTermination(long l, TimeUnit timeUnit) throws InterruptedException { return false; } @Override public void execute(Runnable runnable) { runnable.run(); } }; }
From source file:org.kaaproject.kaa.client.logging.DefaultLogCollectorTest.java
@BeforeClass public static void beforeSuite() { executorContext = Mockito.mock(ExecutorContext.class); executor = Executors.newSingleThreadScheduledExecutor(); Mockito.when(executorContext.getApiExecutor()).thenReturn(new AbstractExecutorService() { @Override/*from www . j a v a 2s.c o m*/ public void execute(Runnable command) { command.run(); } @Override public List<Runnable> shutdownNow() { // TODO Auto-generated method stub return null; } @Override public void shutdown() { // TODO Auto-generated method stub } @Override public boolean isTerminated() { // TODO Auto-generated method stub return false; } @Override public boolean isShutdown() { // TODO Auto-generated method stub return false; } @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { // TODO Auto-generated method stub return false; } }); Mockito.when(executorContext.getCallbackExecutor()).thenReturn(executor); Mockito.when(executorContext.getScheduledExecutor()).thenReturn(executor); }