|
@@ -29,13 +29,14 @@ import com.dmdirc.commandparser.CommandArguments;
|
29
|
29
|
import com.dmdirc.commandparser.commands.context.ChatCommandContext;
|
30
|
30
|
import com.dmdirc.commandparser.commands.global.Echo;
|
31
|
31
|
import com.dmdirc.commandparser.parsers.CommandParser;
|
|
32
|
+import com.dmdirc.config.ConfigBinder;
|
32
|
33
|
import com.dmdirc.interfaces.CommandController;
|
33
|
34
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
34
|
35
|
import com.dmdirc.interfaces.ui.InputWindow;
|
35
|
36
|
import com.dmdirc.ui.WindowManager;
|
36
|
|
-import com.dmdirc.ui.messages.BackBufferFactory;
|
37
|
37
|
import com.dmdirc.ui.input.TabCompleter;
|
38
|
38
|
import com.dmdirc.ui.input.TabCompleterUtils;
|
|
39
|
+import com.dmdirc.ui.messages.BackBufferFactory;
|
39
|
40
|
import com.dmdirc.ui.messages.sink.MessageSinkManager;
|
40
|
41
|
import com.dmdirc.util.URLBuilder;
|
41
|
42
|
|
|
@@ -45,9 +46,7 @@ import org.junit.Before;
|
45
|
46
|
import org.junit.Test;
|
46
|
47
|
import org.junit.runner.RunWith;
|
47
|
48
|
import org.mockito.Mock;
|
48
|
|
-import org.mockito.invocation.InvocationOnMock;
|
49
|
49
|
import org.mockito.runners.MockitoJUnitRunner;
|
50
|
|
-import org.mockito.stubbing.Answer;
|
51
|
50
|
|
52
|
51
|
import static org.mockito.Matchers.any;
|
53
|
52
|
import static org.mockito.Matchers.eq;
|
|
@@ -63,6 +62,7 @@ public class RedirectCommandTest {
|
63
|
62
|
@Mock private CommandController commandController;
|
64
|
63
|
@Mock private FrameContainer frameContainer;
|
65
|
64
|
@Mock private AggregateConfigProvider configProvider;
|
|
65
|
+ @Mock private ConfigBinder configBinder;
|
66
|
66
|
@Mock private CommandParser commandParser;
|
67
|
67
|
@Mock private TabCompleter tabCompleter;
|
68
|
68
|
@Mock private MessageSinkManager messageSinkManager;
|
|
@@ -83,15 +83,13 @@ public class RedirectCommandTest {
|
83
|
83
|
when(target.getTabCompleter()).thenReturn(tabCompleter);
|
84
|
84
|
when(configProvider.hasOptionString("formatter", "commandOutput")).thenReturn(true);
|
85
|
85
|
when(configProvider.getOption("formatter", "commandOutput")).thenReturn("%1$s");
|
86
|
|
- doAnswer(new Answer<Void>() {
|
87
|
|
- @Override
|
88
|
|
- public Void answer(final InvocationOnMock invocation) throws Throwable {
|
89
|
|
- new Echo(commandController, windowManager).execute(
|
90
|
|
- (FrameContainer) invocation.getArguments()[0],
|
91
|
|
- new CommandArguments(commandController, "/echo test"),
|
92
|
|
- null);
|
93
|
|
- return null;
|
94
|
|
- }
|
|
86
|
+ when(configProvider.getBinder()).thenReturn(configBinder);
|
|
87
|
+ doAnswer(invocation -> {
|
|
88
|
+ new Echo(commandController, windowManager).execute(
|
|
89
|
+ (FrameContainer) invocation.getArguments()[0],
|
|
90
|
+ new CommandArguments(commandController, "/echo test"),
|
|
91
|
+ null);
|
|
92
|
+ return null;
|
95
|
93
|
}).when(commandParser).parseCommand(any(FrameContainer.class), eq("/echo test"));
|
96
|
94
|
}
|
97
|
95
|
|