Extract interface as method return
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
ba61efaa4a
commit
c1ce1277d3
@ -79,6 +79,8 @@ import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||
import net.bigeon.gclc.swt.api.ConsoleDelayIO;
|
||||
import net.bigeon.gclc.swt.api.ConsoleOutputDisplay;
|
||||
import net.bigeon.gclc.swt.io.ConsoleInputManager;
|
||||
import net.bigeon.gclc.swt.io.ConsoleOutputManager;
|
||||
import net.bigeon.gclc.swt.io.ConsolePromptManager;
|
||||
@ -131,12 +133,12 @@ public final class SWTConsole extends Composite {
|
||||
}
|
||||
|
||||
/** @return the inputManager */
|
||||
public ConsoleInputManager getInputManager() {
|
||||
public ConsoleDelayIO getInputManager() {
|
||||
return inputManager;
|
||||
}
|
||||
|
||||
/** @return the outputManager */
|
||||
public ConsoleOutputManager getOutputManager() {
|
||||
public ConsoleOutputDisplay getOutputManager() {
|
||||
return outputManager;
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,8 @@ import org.eclipse.swt.widgets.Text;
|
||||
import net.bigeon.gclc.ConsoleApplication;
|
||||
import net.bigeon.gclc.manager.PipedConsoleInput;
|
||||
import net.bigeon.gclc.manager.PipedConsoleOutput;
|
||||
import net.bigeon.gclc.swt.api.ConsoleDelayIO;
|
||||
import net.bigeon.gclc.swt.api.ConsoleOutputDisplay;
|
||||
import net.bigeon.gclc.swt.io.ConsoleInputManager;
|
||||
import net.bigeon.gclc.swt.io.ConsoleOutputManager;
|
||||
import net.bigeon.gclc.swt.tools.HistoryTextKeyListener;
|
||||
@ -132,14 +134,14 @@ public final class SWTConsoleView extends Composite {
|
||||
/** Get the manager of console input.
|
||||
*
|
||||
* @return the input manager */
|
||||
public ConsoleInputManager getInputManager() {
|
||||
public ConsoleDelayIO getInputManager() {
|
||||
return inManager;
|
||||
}
|
||||
|
||||
/** Get the manager of console output.
|
||||
*
|
||||
* @return the output manager */
|
||||
public ConsoleOutputManager getOutputManager() {
|
||||
public ConsoleOutputDisplay getOutputManager() {
|
||||
return outManager;
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,7 @@ import java.util.logging.Logger;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.junit.Test;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import net.bigeon.gclc.swt.tools.PromptReadingRunnable;
|
||||
|
||||
@ -61,16 +60,10 @@ public class PromptReadingRunnableTest {
|
||||
private final Display display = mock(Display.class);
|
||||
{
|
||||
when(view.getDisplay()).thenReturn(display);
|
||||
doAnswer(new Answer<Object>() {
|
||||
/* (non-Javadoc)
|
||||
* @see
|
||||
* org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock) */
|
||||
@Override
|
||||
public Object answer(final InvocationOnMock invocation) throws Throwable {
|
||||
doAnswer(invocation -> {
|
||||
final Runnable runnable = invocation.getArgument(0);
|
||||
runnable.run();
|
||||
return null;
|
||||
}
|
||||
}).when(display).syncExec(any(Runnable.class));
|
||||
}
|
||||
|
||||
@ -85,6 +78,7 @@ public class PromptReadingRunnableTest {
|
||||
final PromptReadingRunnable runnable = new PromptReadingRunnable(reader, view);
|
||||
|
||||
runnable.run();
|
||||
Mockito.verify(reader, Mockito.times(3)).readLine();
|
||||
}
|
||||
|
||||
/** Test method for {@link net.bigeon.gclc.swt.tools.PromptReadingRunnable#run()}.
|
||||
@ -102,6 +96,7 @@ public class PromptReadingRunnableTest {
|
||||
|
||||
runnable.run();
|
||||
logger.setLevel(back);
|
||||
Mockito.verify(reader, Mockito.times(3)).readLine();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user