/* * @see DATAREDIS-415 */ @Test public void interruptAtStart() throws Exception { final Thread main = Thread.currentThread(); // interrupt thread once Executor.execute is called doAnswer( new Answer<Object>() { @Override public Object answer(final InvocationOnMock invocationOnMock) throws Throwable { main.interrupt(); return null; } }) .when(executorMock) .execute(any(Runnable.class)); container.addMessageListener(adapter, new ChannelTopic("a")); container.start(); // reset the interrupted flag to not destroy the teardown assertThat(Thread.interrupted(), is(true)); assertThat(container.isRunning(), is(false)); }