Преглед изворни кода

Rename getOptionalConnection() to getConnection().

pull/212/head
Chris Smith пре 9 година
родитељ
комит
f830257585
38 измењених фајлова са 48 додато и 51 уклоњено
  1. 1
    1
      src/com/dmdirc/Channel.java
  2. 1
    1
      src/com/dmdirc/ChannelEventHandler.java
  3. 2
    2
      src/com/dmdirc/CustomWindow.java
  4. 1
    1
      src/com/dmdirc/FrameContainer.java
  5. 1
    1
      src/com/dmdirc/GlobalWindow.java
  6. 1
    1
      src/com/dmdirc/Query.java
  7. 1
    1
      src/com/dmdirc/Raw.java
  8. 1
    1
      src/com/dmdirc/Server.java
  9. 2
    2
      src/com/dmdirc/actions/ActionSubstitutor.java
  10. 1
    1
      src/com/dmdirc/actions/CoreActionComponent.java
  11. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Mode.java
  12. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Names.java
  13. 1
    1
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  14. 1
    1
      src/com/dmdirc/commandparser/commands/chat/Me.java
  15. 1
    1
      src/com/dmdirc/commandparser/commands/context/ChatCommandContext.java
  16. 1
    2
      src/com/dmdirc/commandparser/commands/global/Echo.java
  17. 1
    1
      src/com/dmdirc/commandparser/commands/global/OpenWindow.java
  18. 1
    1
      src/com/dmdirc/commandparser/commands/global/SetCommand.java
  19. 1
    1
      src/com/dmdirc/commandparser/commands/server/Ignore.java
  20. 1
    1
      src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java
  21. 1
    1
      src/com/dmdirc/commandparser/commands/server/Message.java
  22. 1
    1
      src/com/dmdirc/commandparser/commands/server/OpenQuery.java
  23. 1
    1
      src/com/dmdirc/commandparser/parsers/CommandParser.java
  24. 1
    1
      src/com/dmdirc/interfaces/Chat.java
  25. 1
    1
      src/com/dmdirc/ui/messages/BackBuffer.java
  26. 1
    1
      src/com/dmdirc/ui/messages/sink/AllMessageSink.java
  27. 1
    1
      src/com/dmdirc/ui/messages/sink/ChannelMessageSink.java
  28. 1
    1
      src/com/dmdirc/ui/messages/sink/CommonChannelsMessageSink.java
  29. 1
    2
      src/com/dmdirc/ui/messages/sink/CustomWindowMessageSink.java
  30. 1
    1
      src/com/dmdirc/ui/messages/sink/LastCommandMessageSink.java
  31. 1
    2
      src/com/dmdirc/ui/messages/sink/ServerMessageSink.java
  32. 1
    1
      test/com/dmdirc/actions/ActionSubstitutorTest.java
  33. 2
    2
      test/com/dmdirc/commandparser/commands/channel/BanTest.java
  34. 4
    4
      test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java
  35. 1
    1
      test/com/dmdirc/commandparser/commands/channel/ModeTest.java
  36. 1
    1
      test/com/dmdirc/commandparser/commands/channel/NamesTest.java
  37. 5
    5
      test/com/dmdirc/commandparser/parsers/CommandParserTest.java
  38. 1
    1
      test/com/dmdirc/harness/TestWritableFrameContainer.java

+ 1
- 1
src/com/dmdirc/Channel.java Прегледај датотеку

@@ -548,7 +548,7 @@ public class Channel extends MessageTarget implements GroupChat {
548 548
     }
549 549
 
550 550
     @Override
551
-    public Optional<Connection> getOptionalConnection() {
551
+    public Optional<Connection> getConnection() {
552 552
         return Optional.of(server);
553 553
     }
554 554
 

+ 1
- 1
src/com/dmdirc/ChannelEventHandler.java Прегледај датотеку

@@ -114,7 +114,7 @@ public class ChannelEventHandler extends EventHandler implements
114 114
     @Nonnull
115 115
     @Override
116 116
     protected Connection getConnection() {
117
-        return owner.getOptionalConnection().get();
117
+        return owner.getConnection().get();
118 118
     }
119 119
 
120 120
     /**

+ 2
- 2
src/com/dmdirc/CustomWindow.java Прегледај датотеку

@@ -65,8 +65,8 @@ public class CustomWindow extends FrameContainer {
65 65
     }
66 66
 
67 67
     @Override
68
-    public Optional<Connection> getOptionalConnection() {
69
-        return getParent().flatMap(FrameContainer::getOptionalConnection);
68
+    public Optional<Connection> getConnection() {
69
+        return getParent().flatMap(FrameContainer::getConnection);
70 70
     }
71 71
 
72 72
 }

+ 1
- 1
src/com/dmdirc/FrameContainer.java Прегледај датотеку

@@ -349,7 +349,7 @@ public abstract class FrameContainer {
349 349
      *
350 350
      * @return the associated connection.
351 351
      */
352
-    public abstract Optional<Connection> getOptionalConnection();
352
+    public abstract Optional<Connection> getConnection();
353 353
 
354 354
     /**
355 355
      * Sets the icon to be used by this frame container and fires a {@link FrameIconChangedEvent}.

+ 1
- 1
src/com/dmdirc/GlobalWindow.java Прегледај датотеку

@@ -64,7 +64,7 @@ public class GlobalWindow extends FrameContainer {
64 64
     }
65 65
 
66 66
     @Override
67
-    public Optional<Connection> getOptionalConnection() {
67
+    public Optional<Connection> getConnection() {
68 68
         return Optional.empty();
69 69
     }
70 70
 

+ 1
- 1
src/com/dmdirc/Query.java Прегледај датотеку

@@ -285,7 +285,7 @@ public class Query extends MessageTarget implements PrivateActionListener,
285 285
     }
286 286
 
287 287
     @Override
288
-    public Optional<Connection> getOptionalConnection() {
288
+    public Optional<Connection> getConnection() {
289 289
         return Optional.of(server);
290 290
     }
291 291
 

+ 1
- 1
src/com/dmdirc/Raw.java Прегледај датотеку

@@ -112,7 +112,7 @@ public class Raw extends FrameContainer implements DataInListener, DataOutListen
112 112
     }
113 113
 
114 114
     @Override
115
-    public Optional<Connection> getOptionalConnection() {
115
+    public Optional<Connection> getConnection() {
116 116
         return Optional.of(server);
117 117
     }
118 118
 

+ 1
- 1
src/com/dmdirc/Server.java Прегледај датотеку

@@ -1038,7 +1038,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
1038 1038
     }
1039 1039
 
1040 1040
     @Override
1041
-    public Optional<Connection> getOptionalConnection() {
1041
+    public Optional<Connection> getConnection() {
1042 1042
         return Optional.of(this);
1043 1043
     }
1044 1044
 

+ 2
- 2
src/com/dmdirc/actions/ActionSubstitutor.java Прегледај датотеку

@@ -279,7 +279,7 @@ public class ActionSubstitutor {
279 279
 
280 280
         if (hasFrameContainer() && serverMatcher.matches()) {
281 281
             final Optional<Connection> connection =
282
-                    ((FrameContainer) args[0]).getOptionalConnection();
282
+                    ((FrameContainer) args[0]).getConnection();
283 283
 
284 284
             if (connection.isPresent()) {
285 285
                 try {
@@ -311,7 +311,7 @@ public class ActionSubstitutor {
311 311
     protected String checkConnection(final ActionComponentChain chain,
312 312
             final Object[] args, final Object argument) {
313 313
         if ((chain.requiresConnection() && args[0] instanceof FrameContainer
314
-                && ((FrameContainer) args[0]).getOptionalConnection().get().getState()
314
+                && ((FrameContainer) args[0]).getConnection().get().getState()
315 315
                 == ServerState.CONNECTED) || !chain.requiresConnection()) {
316 316
             final Object res = chain.get(argument);
317 317
             return res == null ? ERR_NULL_CHAIN : res.toString();

+ 1
- 1
src/com/dmdirc/actions/CoreActionComponent.java Прегледај датотеку

@@ -730,7 +730,7 @@ public enum CoreActionComponent implements ActionComponent {
730 730
     WINDOW_SERVER {
731 731
         @Override
732 732
         public Object get(final Object arg) {
733
-            return ((Window) arg).getContainer().getOptionalConnection().orElse(null);
733
+            return ((Window) arg).getContainer().getConnection().orElse(null);
734 734
         }
735 735
 
736 736
         @Override

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Mode.java Прегледај датотеку

@@ -74,7 +74,7 @@ public class Mode extends Command implements IntelligentCommand,
74 74
         if (args.getArguments().length == 0) {
75 75
             sendLine(origin, args.isSilent(), "channelModeDiscovered", cChannel.getModes(), cChannel);
76 76
         } else {
77
-            channel.getOptionalConnection().get().getParser().sendRawMessage("MODE "
77
+            channel.getConnection().get().getParser().sendRawMessage("MODE "
78 78
                     + cChannel + " " + args.getArgumentsAsString());
79 79
         }
80 80
     }

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Names.java Прегледај датотеку

@@ -67,7 +67,7 @@ public class Names extends Command implements IntelligentCommand,
67 67
     public void execute(@Nonnull final FrameContainer origin,
68 68
             final CommandArguments args, final CommandContext context) {
69 69
         final Channel channel = ((ChannelCommandContext) context).getChannel();
70
-        channel.getOptionalConnection().get().getParser().sendRawMessage("NAMES "
70
+        channel.getConnection().get().getParser().sendRawMessage("NAMES "
71 71
                 + channel.getChannelInfo().getName());
72 72
     }
73 73
 

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java Прегледај датотеку

@@ -71,7 +71,7 @@ public class ShowTopic extends Command implements ExternalCommand {
71 71
             if (cChannel.getTopic().isEmpty()) {
72 72
                 sendLine(origin, args.isSilent(), "channelNoTopic", cChannel);
73 73
             } else {
74
-                final String[] parts = channel.getOptionalConnection().get().parseHostmask(
74
+                final String[] parts = channel.getConnection().get().parseHostmask(
75 75
                         cChannel.getTopicSetter());
76 76
 
77 77
                 sendLine(origin, args.isSilent(), "channelTopicDiscovered",

+ 1
- 1
src/com/dmdirc/commandparser/commands/chat/Me.java Прегледај датотеку

@@ -78,7 +78,7 @@ public class Me extends Command implements ValidatingCommand {
78 78
     public ValidationResponse validateArguments(
79 79
             final FrameContainer origin,
80 80
             final CommandArguments arguments) {
81
-        final Optional<Connection> connection = origin.getOptionalConnection();
81
+        final Optional<Connection> connection = origin.getConnection();
82 82
         final Optional<Parser> parser = connection.flatMap(c -> Optional.ofNullable(c.getParser()));
83 83
 
84 84
         if (!parser.isPresent()) {

+ 1
- 1
src/com/dmdirc/commandparser/commands/context/ChatCommandContext.java Прегледај датотеку

@@ -49,7 +49,7 @@ public class ChatCommandContext extends ServerCommandContext {
49 49
             final CommandInfo commandInfo, final MessageTarget chat) {
50 50
         super(source, commandInfo,
51 51
                 Optional.ofNullable(source)
52
-                        .flatMap(FrameContainer::getOptionalConnection)
52
+                        .flatMap(FrameContainer::getConnection)
53 53
                         .orElse(null));
54 54
         this.chat = chat;
55 55
     }

+ 1
- 2
src/com/dmdirc/commandparser/commands/global/Echo.java Прегледај датотеку

@@ -43,7 +43,6 @@ import com.dmdirc.ui.input.AdditionalTabTargets;
43 43
 import java.util.ArrayList;
44 44
 import java.util.Collection;
45 45
 import java.util.Date;
46
-import java.util.List;
47 46
 import java.util.Optional;
48 47
 import java.util.stream.Collectors;
49 48
 
@@ -141,7 +140,7 @@ public class Echo extends Command implements IntelligentCommand {
141 140
                 && context.getPreviousArgs().get(0).equals("--ts"))) {
142 141
 
143 142
             final Collection<FrameContainer> windowList = new ArrayList<>();
144
-            final Optional<Connection> connection = context.getWindow().getOptionalConnection();
143
+            final Optional<Connection> connection = context.getWindow().getConnection();
145 144
 
146 145
             //Active window's Children
147 146
             windowList.addAll(context.getWindow().getChildren());

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/OpenWindow.java Прегледај датотеку

@@ -94,7 +94,7 @@ public class OpenWindow extends Command implements IntelligentCommand {
94 94
         FrameContainer parent = null;
95 95
 
96 96
         if (args.getArguments().length > 0 && "--server".equals(args.getArguments()[0])) {
97
-            final Optional<Connection> connection = origin.getOptionalConnection();
97
+            final Optional<Connection> connection = origin.getConnection();
98 98
             if (!connection.isPresent()) {
99 99
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
100 100
                         "This window doesn't have an associated server.");

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/SetCommand.java Прегледај датотеку

@@ -114,7 +114,7 @@ public class SetCommand extends Command implements IntelligentCommand {
114 114
 
115 115
         ConfigProvider identity = identityController.getUserSettings();
116 116
         AggregateConfigProvider manager = identityController.getGlobalConfiguration();
117
-        final Optional<Connection> connection = origin.getOptionalConnection();
117
+        final Optional<Connection> connection = origin.getConnection();
118 118
 
119 119
         if (res.hasFlag(serverFlag)) {
120 120
             if (!connection.isPresent()) {

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/Ignore.java Прегледај датотеку

@@ -185,7 +185,7 @@ public class Ignore extends Command implements IntelligentCommand {
185 185
             targets.include(TabCompletionType.CHANNEL_NICK);
186 186
             targets.include(TabCompletionType.QUERY_NICK);
187 187
         } else if (arg == 1 && "--remove".equals(context.getPreviousArgs().get(0))) {
188
-            final IgnoreList ignoreList = context.getWindow().getOptionalConnection()
188
+            final IgnoreList ignoreList = context.getWindow().getConnection()
189 189
                     .get().getIgnoreList();
190 190
             if (ignoreList.canConvert()) {
191 191
                 targets.addAll(ignoreList.getSimpleList().stream().collect(Collectors.toList()));

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java Прегледај датотеку

@@ -119,7 +119,7 @@ public class JoinChannelCommand extends Command implements IntelligentCommand {
119 119
     public AdditionalTabTargets getSuggestions(final int arg,
120 120
             final IntelligentCommandContext context) {
121 121
         final FrameContainer source = context.getWindow();
122
-        final Connection connection = source.getOptionalConnection().get();
122
+        final Connection connection = source.getConnection().get();
123 123
         final List<String> results = checkSource(source, true, true);
124 124
 
125 125
         final AdditionalTabTargets targets = new AdditionalTabTargets().excludeAll();

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/Message.java Прегледај датотеку

@@ -116,7 +116,7 @@ public class Message extends Command implements IntelligentCommand,
116 116
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
117 117
         if (arguments.getArguments().length >= 2) {
118 118
             final String target = arguments.getArguments()[0];
119
-            return origin.getOptionalConnection().get().getWindowModel().getNumLines(
119
+            return origin.getConnection().get().getWindowModel().getNumLines(
120 120
                     "PRIVMSG " + target + " :" + arguments.getArgumentsAsString(1));
121 121
         } else {
122 122
             return 1;

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/OpenQuery.java Прегледај датотеку

@@ -109,7 +109,7 @@ public class OpenQuery extends Command implements IntelligentCommand,
109 109
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
110 110
         if (arguments.getArguments().length >= 2) {
111 111
             final String target = arguments.getArguments()[0];
112
-            return origin.getOptionalConnection().get().getWindowModel().getNumLines("PRIVMSG "
112
+            return origin.getConnection().get().getWindowModel().getNumLines("PRIVMSG "
113 113
                     + target + " :" + arguments.getArgumentsAsString(1));
114 114
         } else {
115 115
             return 1;

+ 1
- 1
src/com/dmdirc/commandparser/parsers/CommandParser.java Прегледај датотеку

@@ -179,7 +179,7 @@ public abstract class CommandParser implements Serializable {
179 179
         final boolean silent = args.isSilent();
180 180
         final String command = args.getCommandName();
181 181
         final String[] cargs = args.getArguments();
182
-        final Optional<Connection> connection = origin.getOptionalConnection();
182
+        final Optional<Connection> connection = origin.getConnection();
183 183
 
184 184
         if (cargs.length == 0
185 185
                 || !parseChannel

+ 1
- 1
src/com/dmdirc/interfaces/Chat.java Прегледај датотеку

@@ -36,7 +36,7 @@ public interface Chat {
36 36
      *
37 37
      * @return This chat's connection.
38 38
      */
39
-    Optional<Connection> getOptionalConnection();
39
+    Optional<Connection> getConnection();
40 40
 
41 41
     /**
42 42
      * Sends an action to the chat. If an action is too long to be sent, an error will be displayed.

+ 1
- 1
src/com/dmdirc/ui/messages/BackBuffer.java Прегледај датотеку

@@ -49,7 +49,7 @@ public class BackBuffer {
49 49
             final ColourManagerFactory colourManagerFactory,
50 50
             final EventFormatter formatter) {
51 51
         this.styliser = new Styliser(
52
-                owner.getOptionalConnection().orElse(null),
52
+                owner.getConnection().orElse(null),
53 53
                 owner.getConfigManager(),
54 54
                 colourManagerFactory.getColourManager(owner.getConfigManager()),
55 55
                 owner.getEventBus());

+ 1
- 1
src/com/dmdirc/ui/messages/sink/AllMessageSink.java Прегледај датотеку

@@ -51,7 +51,7 @@ public class AllMessageSink implements MessageSink {
51 51
             final FrameContainer source,
52 52
             final String[] patternMatches, final Date date,
53 53
             final String messageType, final Object... args) {
54
-        source.getOptionalConnection().get().addLineToAll(messageType, date, args);
54
+        source.getConnection().get().addLineToAll(messageType, date, args);
55 55
     }
56 56
 
57 57
 }

+ 1
- 1
src/com/dmdirc/ui/messages/sink/ChannelMessageSink.java Прегледај датотеку

@@ -58,7 +58,7 @@ public class ChannelMessageSink implements MessageSink {
58 58
         final String user = String.format(patternMatches[0], args);
59 59
         boolean found = false;
60 60
 
61
-        final Connection connection = source.getOptionalConnection().get();
61
+        final Connection connection = source.getConnection().get();
62 62
         for (String channelName : connection.getChannels()) {
63 63
             final Channel channel = connection.getChannel(channelName);
64 64
             if (channel.getChannelInfo().getChannelClient(user) != null) {

+ 1
- 1
src/com/dmdirc/ui/messages/sink/CommonChannelsMessageSink.java Прегледај датотеку

@@ -57,7 +57,7 @@ public class CommonChannelsMessageSink implements MessageSink {
57 57
             final String[] patternMatches, final Date date,
58 58
             final String messageType, final Object... args) {
59 59
         final String user = String.format(patternMatches[0], args);
60
-        final Connection connection = source.getOptionalConnection().get();
60
+        final Connection connection = source.getConnection().get();
61 61
         boolean found = false;
62 62
 
63 63
         for (String channelName : connection.getChannels()) {

+ 1
- 2
src/com/dmdirc/ui/messages/sink/CustomWindowMessageSink.java Прегледај датотеку

@@ -24,7 +24,6 @@ package com.dmdirc.ui.messages.sink;
24 24
 
25 25
 import com.dmdirc.CustomWindow;
26 26
 import com.dmdirc.FrameContainer;
27
-import com.dmdirc.Server;
28 27
 import com.dmdirc.ui.WindowManager;
29 28
 import com.dmdirc.ui.messages.BackBufferFactory;
30 29
 import com.dmdirc.util.URLBuilder;
@@ -71,7 +70,7 @@ public class CustomWindowMessageSink implements MessageSink {
71 70
             final FrameContainer source,
72 71
             final String[] patternMatches, final Date date,
73 72
             final String messageType, final Object... args) {
74
-        final FrameContainer connectionContainer = source.getOptionalConnection()
73
+        final FrameContainer connectionContainer = source.getConnection()
75 74
                 .get().getWindowModel();
76 75
         FrameContainer targetWindow = windowManager
77 76
                 .findCustomWindow(connectionContainer, patternMatches[0]);

+ 1
- 1
src/com/dmdirc/ui/messages/sink/LastCommandMessageSink.java Прегледај датотеку

@@ -66,7 +66,7 @@ public class LastCommandMessageSink implements MessageSink {
66 66
 
67 67
         final Collection<FrameContainer> containers = new ArrayList<>();
68 68
 
69
-        final FrameContainer connectionContainer = source.getOptionalConnection()
69
+        final FrameContainer connectionContainer = source.getConnection()
70 70
                 .get().getWindowModel();
71 71
         containers.add(connectionContainer);
72 72
         containers.addAll(connectionContainer.getChildren());

+ 1
- 2
src/com/dmdirc/ui/messages/sink/ServerMessageSink.java Прегледај датотеку

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.ui.messages.sink;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27 26
 
28 27
 import java.util.Date;
29 28
 import java.util.regex.Pattern;
@@ -52,7 +51,7 @@ public class ServerMessageSink implements MessageSink {
52 51
             final FrameContainer source,
53 52
             final String[] patternMatches, final Date date,
54 53
             final String messageType, final Object... args) {
55
-        source.getOptionalConnection().get().getWindowModel().addLine(messageType, date, args);
54
+        source.getConnection().get().getWindowModel().addLine(messageType, date, args);
56 55
     }
57 56
 
58 57
 }

+ 1
- 1
test/com/dmdirc/actions/ActionSubstitutorTest.java Прегледај датотеку

@@ -75,7 +75,7 @@ public class ActionSubstitutorTest {
75 75
 
76 76
         final ChannelClientInfo clientInfo = mock(ChannelClientInfo.class);
77 77
 
78
-        when(channel.getOptionalConnection()).thenReturn(Optional.of(server));
78
+        when(channel.getConnection()).thenReturn(Optional.of(server));
79 79
         when(channel.getConfigManager()).thenReturn(manager);
80 80
         when(server.getState()).thenReturn(ServerState.DISCONNECTED);
81 81
         when(server.getAwayMessage()).thenReturn("foo");

+ 2
- 2
test/com/dmdirc/commandparser/commands/channel/BanTest.java Прегледај датотеку

@@ -77,7 +77,7 @@ public class BanTest {
77 77
         when(channelInfo.getChannelClient("user")).thenReturn(ccInfo);
78 78
         when(ccInfo.getClient()).thenReturn(clientInfo);
79 79
         when(clientInfo.getHostname()).thenReturn("my.host.name");
80
-        when(container.getOptionalConnection()).thenReturn(Optional.empty());
80
+        when(container.getConnection()).thenReturn(Optional.empty());
81 81
 
82 82
         command.execute(container, new CommandArguments(controller, "/ban user"),
83 83
                 new ChannelCommandContext(null, Ban.INFO, channel));
@@ -94,7 +94,7 @@ public class BanTest {
94 94
         final Channel channel = mock(Channel.class);
95 95
 
96 96
         when(channel.getChannelInfo()).thenReturn(channelInfo);
97
-        when(container.getOptionalConnection()).thenReturn(Optional.empty());
97
+        when(container.getConnection()).thenReturn(Optional.empty());
98 98
 
99 99
         command.execute(container, new CommandArguments(controller, "/ban *!*@my.host.name"),
100 100
                 new ChannelCommandContext(null, Ban.INFO, channel));

+ 4
- 4
test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java Прегледај датотеку

@@ -65,7 +65,7 @@ public class KickReasonTest {
65 65
         final FrameContainer tiw = mock(FrameContainer.class);
66 66
         final Channel channel = mock(Channel.class);
67 67
 
68
-        when(tiw.getOptionalConnection()).thenReturn(Optional.empty());
68
+        when(tiw.getConnection()).thenReturn(Optional.empty());
69 69
 
70 70
         command.execute(tiw, new CommandArguments(controller, "/kick"),
71 71
                 new ChannelCommandContext(null, KickReason.INFO, channel));
@@ -81,7 +81,7 @@ public class KickReasonTest {
81 81
 
82 82
         when(channel.getChannelInfo()).thenReturn(channelInfo);
83 83
         when(channelInfo.getChannelClient(anyString())).thenReturn(null);
84
-        when(tiw.getOptionalConnection()).thenReturn(Optional.empty());
84
+        when(tiw.getConnection()).thenReturn(Optional.empty());
85 85
 
86 86
         command.execute(tiw, new CommandArguments(controller, "/kick user1"),
87 87
                 new ChannelCommandContext(null, KickReason.INFO, channel));
@@ -98,7 +98,7 @@ public class KickReasonTest {
98 98
 
99 99
         when(channel.getChannelInfo()).thenReturn(channelInfo);
100 100
         when(channelInfo.getChannelClient("user1")).thenReturn(cci);
101
-        when(tiw.getOptionalConnection()).thenReturn(Optional.empty());
101
+        when(tiw.getConnection()).thenReturn(Optional.empty());
102 102
 
103 103
         command.execute(tiw, new CommandArguments(controller, "/kick user1 reason here"),
104 104
                 new ChannelCommandContext(null, KickReason.INFO, channel));
@@ -118,7 +118,7 @@ public class KickReasonTest {
118 118
         when(channel.getChannelInfo()).thenReturn(channelInfo);
119 119
         when(channelInfo.getChannelClient("user1")).thenReturn(cci);
120 120
         when(manager.getOption("general", "kickmessage")).thenReturn("reason here");
121
-        when(tiw.getOptionalConnection()).thenReturn(Optional.empty());
121
+        when(tiw.getConnection()).thenReturn(Optional.empty());
122 122
 
123 123
         command.execute(tiw, new CommandArguments(controller, "/kick user1"),
124 124
                 new ChannelCommandContext(null, KickReason.INFO, channel));

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/ModeTest.java Прегледај датотеку

@@ -56,7 +56,7 @@ public class ModeTest {
56 56
 
57 57
     @Before
58 58
     public void setUp() throws InvalidIdentityFileException {
59
-        when(channel.getOptionalConnection()).thenReturn(Optional.of(server));
59
+        when(channel.getConnection()).thenReturn(Optional.of(server));
60 60
         when(server.getParser()).thenReturn(parser);
61 61
         when(channel.getChannelInfo()).thenReturn(channelinfo);
62 62
         when(channelinfo.getModes()).thenReturn("my mode string!");

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/NamesTest.java Прегледај датотеку

@@ -55,7 +55,7 @@ public class NamesTest {
55 55
 
56 56
     @Before
57 57
     public void setUp() throws InvalidIdentityFileException {
58
-        when(channel.getOptionalConnection()).thenReturn(Optional.of(server));
58
+        when(channel.getConnection()).thenReturn(Optional.of(server));
59 59
         when(server.getParser()).thenReturn(parser);
60 60
         when(channel.getChannelInfo()).thenReturn(channelinfo);
61 61
         when(channelinfo.getName()).thenReturn("#chan");

+ 5
- 5
test/com/dmdirc/commandparser/parsers/CommandParserTest.java Прегледај датотеку

@@ -74,7 +74,7 @@ public class CommandParserTest {
74 74
 
75 75
         when(configProvider.getOptionInt("general", "commandhistory")).thenReturn(10);
76 76
 
77
-        when(container.getOptionalConnection()).thenReturn(Optional.of(connection));
77
+        when(container.getConnection()).thenReturn(Optional.of(connection));
78 78
         when(connection.isValidChannelName("#channel1")).thenReturn(true);
79 79
         when(connection.isValidChannelName("#channel2")).thenReturn(true);
80 80
         when(connection.hasChannel("#channel1")).thenReturn(true);
@@ -191,7 +191,7 @@ public class CommandParserTest {
191 191
 
192 192
     @Test
193 193
     public void testParseChannelCommandWithArguments() {
194
-        when(container.getOptionalConnection()).thenReturn(Optional.of(connection));
194
+        when(container.getConnection()).thenReturn(Optional.of(connection));
195 195
         commandParser.parseCommand(container, "/channel #channel1 this is a test");
196 196
 
197 197
         assertNull(channelCommandParser.nonCommandLine);
@@ -203,7 +203,7 @@ public class CommandParserTest {
203 203
 
204 204
     @Test
205 205
     public void testParseChannelCommandWithoutArguments() {
206
-        when(container.getOptionalConnection()).thenReturn(Optional.of(connection));
206
+        when(container.getConnection()).thenReturn(Optional.of(connection));
207 207
         commandParser.parseCommand(container, "/channel #channel1");
208 208
 
209 209
         assertNull(channelCommandParser.nonCommandLine);
@@ -215,7 +215,7 @@ public class CommandParserTest {
215 215
 
216 216
     @Test
217 217
     public void testParseSilencedChannelCommandWithArguments() {
218
-        when(container.getOptionalConnection()).thenReturn(Optional.of(connection));
218
+        when(container.getConnection()).thenReturn(Optional.of(connection));
219 219
         commandParser.parseCommand(container, "/.channel #channel1 this is a test");
220 220
 
221 221
         assertNull(channelCommandParser.nonCommandLine);
@@ -227,7 +227,7 @@ public class CommandParserTest {
227 227
 
228 228
     @Test
229 229
     public void testParseSilencedChannelCommandWithoutArguments() {
230
-        when(container.getOptionalConnection()).thenReturn(Optional.of(connection));
230
+        when(container.getConnection()).thenReturn(Optional.of(connection));
231 231
         commandParser.parseCommand(container, "/.channel #channel1");
232 232
 
233 233
         assertNull(channelCommandParser.nonCommandLine);

+ 1
- 1
test/com/dmdirc/harness/TestWritableFrameContainer.java Прегледај датотеку

@@ -69,7 +69,7 @@ public class TestWritableFrameContainer extends FrameContainer {
69 69
     }
70 70
 
71 71
     @Override
72
-    public Optional<Connection> getOptionalConnection() {
72
+    public Optional<Connection> getConnection() {
73 73
         return Optional.empty();
74 74
     }
75 75
 

Loading…
Откажи
Сачувај