Просмотр исходного кода

Remove unused circular dep, tidy tests.

Remove all tests that depend on TestParser - they're rubbish and
need to be completely rewritten to be proper unit tests.
pull/75/head
Chris Smith 9 лет назад
Родитель
Сommit
db20dd3434
38 измененных файлов: 83 добавлений и 1274 удалений
  1. 23
    25
      irc/src/com/dmdirc/parser/irc/ProcessingManager.java
  2. 3
    4
      irc/src/com/dmdirc/parser/irc/TimestampedIRCProcessor.java
  3. 2
    9
      irc/src/com/dmdirc/parser/irc/processors/IRCProcessor.java
  4. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/Process001.java
  5. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/Process004005.java
  6. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/Process464.java
  7. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessAccount.java
  8. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessAway.java
  9. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessCap.java
  10. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessInvite.java
  11. 2
    5
      irc/src/com/dmdirc/parser/irc/processors/ProcessJoin.java
  12. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessKick.java
  13. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessList.java
  14. 2
    5
      irc/src/com/dmdirc/parser/irc/processors/ProcessListModes.java
  15. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessMOTD.java
  16. 2
    5
      irc/src/com/dmdirc/parser/irc/processors/ProcessMessage.java
  17. 2
    5
      irc/src/com/dmdirc/parser/irc/processors/ProcessMode.java
  18. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNames.java
  19. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNick.java
  20. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNickInUse.java
  21. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java
  22. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessPart.java
  23. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessQuit.java
  24. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessTopic.java
  25. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessWallops.java
  26. 2
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessWho.java
  27. 0
    346
      irc/test/com/dmdirc/parser/irc/IRCParserTest.java
  28. 1
    1
      irc/test/com/dmdirc/parser/irc/processors/Process001Test.java
  29. 0
    80
      irc/test/com/dmdirc/parser/irc/processors/Process004005Test.java
  30. 8
    8
      irc/test/com/dmdirc/parser/irc/processors/Process464Test.java
  31. 0
    65
      irc/test/com/dmdirc/parser/irc/processors/ProcessJoinTest.java
  32. 0
    94
      irc/test/com/dmdirc/parser/irc/processors/ProcessMessageTest.java
  33. 0
    81
      irc/test/com/dmdirc/parser/irc/processors/ProcessNamesTest.java
  34. 0
    115
      irc/test/com/dmdirc/parser/irc/processors/ProcessNickTest.java
  35. 0
    90
      irc/test/com/dmdirc/parser/irc/processors/ProcessPartTest.java
  36. 0
    122
      irc/test/com/dmdirc/parser/irc/processors/ProcessQuitTest.java
  37. 0
    79
      irc/test/com/dmdirc/parser/irc/processors/ProcessTopicTest.java
  38. 0
    59
      irc/test/com/dmdirc/parser/irc/processors/ProcessWhoTest.java

+ 23
- 25
irc/src/com/dmdirc/parser/irc/ProcessingManager.java Просмотреть файл

@@ -79,54 +79,52 @@ public class ProcessingManager {
79 79
         // Add processors
80 80
         //------------------------------------------------
81 81
         // NOTICE AUTH
82
-        addProcessor(new ProcessNoticeAuth(parser, this));
82
+        addProcessor(new ProcessNoticeAuth(parser));
83 83
         // 001
84
-        addProcessor(new Process001(parser, this));
84
+        addProcessor(new Process001(parser));
85 85
         // 004
86 86
         // 005
87
-        addProcessor(new Process004005(parser, this));
87
+        addProcessor(new Process004005(parser));
88 88
         // 464
89
-        addProcessor(new Process464(parser, this));
89
+        addProcessor(new Process464(parser));
90 90
         // 301
91 91
         // 305
92 92
         // 306
93
-        addProcessor(new ProcessAway(parser, this));
93
+        addProcessor(new ProcessAway(parser));
94 94
         // 352
95
-        addProcessor(new ProcessWho(parser, this));
95
+        addProcessor(new ProcessWho(parser));
96 96
         // INVITE
97
-        addProcessor(new ProcessInvite(parser, this));
97
+        addProcessor(new ProcessInvite(parser));
98 98
         // JOIN
99
-        addProcessor(new ProcessJoin(parser, prefixModeManager, userModeManager, chanModeManager,
100
-                this));
99
+        addProcessor(new ProcessJoin(parser, prefixModeManager, userModeManager, chanModeManager));
101 100
         // KICK
102
-        addProcessor(new ProcessKick(parser, this));
101
+        addProcessor(new ProcessKick(parser));
103 102
         // PRIVMSG
104 103
         // NOTICE
105
-        addProcessor(new ProcessMessage(parser, prefixModeManager, this));
104
+        addProcessor(new ProcessMessage(parser, prefixModeManager));
106 105
         // MODE
107 106
         // 324
108
-        addProcessor(new ProcessMode(parser, prefixModeManager, userModeManager, chanModeManager,
109
-                this));
107
+        addProcessor(new ProcessMode(parser, prefixModeManager, userModeManager, chanModeManager));
110 108
         // 372
111 109
         // 375
112 110
         // 376
113 111
         // 422
114
-        addProcessor(new ProcessMOTD(parser, this));
112
+        addProcessor(new ProcessMOTD(parser));
115 113
         // 353
116 114
         // 366
117
-        addProcessor(new ProcessNames(parser, prefixModeManager, userModeManager, this));
115
+        addProcessor(new ProcessNames(parser, prefixModeManager, userModeManager));
118 116
         // 433
119
-        addProcessor(new ProcessNickInUse(parser, this));
117
+        addProcessor(new ProcessNickInUse(parser));
120 118
         // NICK
121
-        addProcessor(new ProcessNick(parser, this));
119
+        addProcessor(new ProcessNick(parser));
122 120
         // PART
123
-        addProcessor(new ProcessPart(parser, this));
121
+        addProcessor(new ProcessPart(parser));
124 122
         // QUIT
125
-        addProcessor(new ProcessQuit(parser, this));
123
+        addProcessor(new ProcessQuit(parser));
126 124
         // TOPIC
127 125
         // 332
128 126
         // 333
129
-        addProcessor(new ProcessTopic(parser, this));
127
+        addProcessor(new ProcessTopic(parser));
130 128
         // 344
131 129
         // 345
132 130
         // 346
@@ -135,17 +133,17 @@ public class ProcessingManager {
135 133
         // 349
136 134
         // 367
137 135
         // 368
138
-        addProcessor(new ProcessListModes(parser, this));
136
+        addProcessor(new ProcessListModes(parser));
139 137
         // WALLOPS
140
-        addProcessor(new ProcessWallops(parser, this));
138
+        addProcessor(new ProcessWallops(parser));
141 139
         // 321
142 140
         // 322
143 141
         // 323
144
-        addProcessor(new ProcessList(parser, this));
142
+        addProcessor(new ProcessList(parser));
145 143
         // CAP
146
-        addProcessor(new ProcessCap(parser, this));
144
+        addProcessor(new ProcessCap(parser));
147 145
         // ACCOUNT
148
-        addProcessor(new ProcessAccount(parser, this));
146
+        addProcessor(new ProcessAccount(parser));
149 147
     }
150 148
 
151 149
     /**

+ 3
- 4
irc/src/com/dmdirc/parser/irc/TimestampedIRCProcessor.java Просмотреть файл

@@ -32,16 +32,15 @@ import java.util.Date;
32 32
  * Superclass for all IRCProcessor types that accept timestamps for process.
33 33
  */
34 34
 public abstract class TimestampedIRCProcessor extends IRCProcessor {
35
+
35 36
     /**
36 37
      * Create a new instance of the IRCTimestampedProcessor Object.
37 38
      *
38 39
      * @param parser IRCParser That owns this IRCProcessor
39
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
40 40
      * @param handledTokens Tokens that this processor handles
41 41
      */
42
-    protected TimestampedIRCProcessor(final IRCParser parser, final ProcessingManager manager,
43
-            final String... handledTokens) {
44
-        super(parser, manager, handledTokens);
42
+    protected TimestampedIRCProcessor(final IRCParser parser, final String... handledTokens) {
43
+        super(parser, handledTokens);
45 44
     }
46 45
 
47 46
     @Override

+ 2
- 9
irc/src/com/dmdirc/parser/irc/processors/IRCProcessor.java Просмотреть файл

@@ -28,7 +28,6 @@ import com.dmdirc.parser.common.QueuePriority;
28 28
 import com.dmdirc.parser.irc.IRCChannelInfo;
29 29
 import com.dmdirc.parser.irc.IRCClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCParser;
31
-import com.dmdirc.parser.irc.ProcessingManager;
32 31
 
33 32
 /**
34 33
  * IRCProcessor.
@@ -38,8 +37,6 @@ public abstract class IRCProcessor {
38 37
 
39 38
     /** Reference to the IRCParser that owns this IRCProcessor. */
40 39
     protected final IRCParser parser;
41
-    /** Reference to the Processing in charge of this IRCProcessor. */
42
-    protected final ProcessingManager manager;
43 40
 
44 41
     /** The names of the tokens this processor handles. */
45 42
     private final String[] handledTokens;
@@ -48,15 +45,11 @@ public abstract class IRCProcessor {
48 45
     // is annoying, so we also implement them here (calling them again using parser)
49 46
     /**
50 47
      * Create a new instance of the IRCProcessor Object.
51
-     *
52
-     * @param parser IRCParser That owns this IRCProcessor
53
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
48
+     *  @param parser IRCParser That owns this IRCProcessor
54 49
      * @param handledTokens Tokens that this processor handles
55 50
      */
56
-    protected IRCProcessor(final IRCParser parser, final ProcessingManager manager,
57
-            final String ... handledTokens) {
51
+    protected IRCProcessor(final IRCParser parser, final String... handledTokens) {
58 52
         this.parser = parser;
59
-        this.manager = manager;
60 53
         this.handledTokens = handledTokens;
61 54
     }
62 55
 

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/Process001.java Просмотреть файл

@@ -25,7 +25,6 @@ package com.dmdirc.parser.irc.processors;
25 25
 import com.dmdirc.parser.common.ChannelJoinRequest;
26 26
 import com.dmdirc.parser.common.ParserError;
27 27
 import com.dmdirc.parser.irc.IRCParser;
28
-import com.dmdirc.parser.irc.ProcessingManager;
29 28
 
30 29
 import java.util.Collection;
31 30
 
@@ -38,10 +37,9 @@ public class Process001 extends IRCProcessor {
38 37
      * Create a new instance of the IRCProcessor Object.
39 38
      *
40 39
      * @param parser IRCParser That owns this IRCProcessor
41
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
42 40
      */
43
-    public Process001(final IRCParser parser, final ProcessingManager manager) {
44
-        super(parser, manager, "001");
41
+    public Process001(final IRCParser parser) {
42
+        super(parser, "001");
45 43
     }
46 44
 
47 45
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/Process004005.java Просмотреть файл

@@ -28,7 +28,6 @@ import com.dmdirc.parser.events.NetworkDetectedEvent;
28 28
 import com.dmdirc.parser.irc.CapabilityState;
29 29
 import com.dmdirc.parser.irc.IRCEncoding;
30 30
 import com.dmdirc.parser.irc.IRCParser;
31
-import com.dmdirc.parser.irc.ProcessingManager;
32 31
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
33 32
 
34 33
 import java.util.Date;
@@ -44,10 +43,9 @@ public class Process004005 extends IRCProcessor {
44 43
      * Create a new instance of the IRCProcessor Object.
45 44
      *
46 45
      * @param parser IRCParser That owns this IRCProcessor
47
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
48 46
      */
49
-    public Process004005(final IRCParser parser, final ProcessingManager manager) {
50
-        super(parser, manager, "002", "003", "004", "005");
47
+    public Process004005(final IRCParser parser) {
48
+        super(parser, "002", "003", "004", "005");
51 49
     }
52 50
 
53 51
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/Process464.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.events.PasswordRequiredEvent;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 
29 28
 import java.util.Date;
30 29
 
@@ -37,10 +36,9 @@ public class Process464 extends IRCProcessor {
37 36
      * Create a new instance of the IRCProcessor Object.
38 37
      *
39 38
      * @param parser IRCParser That owns this IRCProcessor
40
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
41 39
      */
42
-    public Process464(final IRCParser parser, final ProcessingManager manager) {
43
-        super(parser, manager, "464");
40
+    public Process464(final IRCParser parser) {
41
+        super(parser, "464");
44 42
     }
45 43
 
46 44
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessAccount.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.irc.IRCClientInfo;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 
29 28
 /**
30 29
  * Process an Account message.
@@ -35,10 +34,9 @@ public class ProcessAccount extends IRCProcessor {
35 34
      * Create a new instance of the IRCProcessor Object.
36 35
      *
37 36
      * @param parser IRCParser That owns this IRCProcessor
38
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
39 37
      */
40
-    public ProcessAccount(final IRCParser parser, final ProcessingManager manager) {
41
-        super(parser, manager, "ACCOUNT");
38
+    public ProcessAccount(final IRCParser parser) {
39
+        super(parser, "ACCOUNT");
42 40
     }
43 41
 
44 42
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessAway.java Просмотреть файл

@@ -25,7 +25,6 @@ import com.dmdirc.parser.common.AwayState;
25 25
 import com.dmdirc.parser.events.AwayStateEvent;
26 26
 import com.dmdirc.parser.irc.IRCClientInfo;
27 27
 import com.dmdirc.parser.irc.IRCParser;
28
-import com.dmdirc.parser.irc.ProcessingManager;
29 28
 
30 29
 import java.util.Date;
31 30
 
@@ -38,10 +37,9 @@ public class ProcessAway extends IRCProcessor {
38 37
      * Create a new instance of the IRCProcessor Object.
39 38
      *
40 39
      * @param parser IRCParser That owns this IRCProcessor
41
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
42 40
      */
43
-    public ProcessAway(final IRCParser parser, final ProcessingManager manager) {
44
-        super(parser, manager, "301", "305", "306", "AWAY");
41
+    public ProcessAway(final IRCParser parser) {
42
+        super(parser, "301", "305", "306", "AWAY");
45 43
     }
46 44
 
47 45
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessCap.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.irc.CapabilityState;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 import com.dmdirc.parser.irc.TimestampedIRCProcessor;
29 28
 
30 29
 import java.util.ArrayList;
@@ -53,10 +52,9 @@ public class ProcessCap extends TimestampedIRCProcessor {
53 52
      * Create a new instance of the IRCProcessor Object.
54 53
      *
55 54
      * @param parser IRCParser That owns this IRCProcessor
56
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
57 55
      */
58
-    public ProcessCap(final IRCParser parser, final ProcessingManager manager) {
59
-        super(parser, manager, "CAP");
56
+    public ProcessCap(final IRCParser parser) {
57
+        super(parser, "CAP");
60 58
 
61 59
         // IRCv3.1 Standard
62 60
         supportedCapabilities.add("multi-prefix");

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessInvite.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.events.InviteEvent;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 
29 28
 import java.util.Date;
30 29
 
@@ -37,10 +36,9 @@ public class ProcessInvite extends IRCProcessor {
37 36
      * Create a new instance of the IRCProcessor Object.
38 37
      *
39 38
      * @param parser IRCParser That owns this IRCProcessor
40
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
41 39
      */
42
-    public ProcessInvite(final IRCParser parser, final ProcessingManager manager) {
43
-        super(parser, manager, "INVITE");
40
+    public ProcessInvite(final IRCParser parser) {
41
+        super(parser, "INVITE");
44 42
     }
45 43
 
46 44
     /**

+ 2
- 5
irc/src/com/dmdirc/parser/irc/processors/ProcessJoin.java Просмотреть файл

@@ -35,7 +35,6 @@ import com.dmdirc.parser.irc.IRCClientInfo;
35 35
 import com.dmdirc.parser.irc.IRCParser;
36 36
 import com.dmdirc.parser.irc.ModeManager;
37 37
 import com.dmdirc.parser.irc.PrefixModeManager;
38
-import com.dmdirc.parser.irc.ProcessingManager;
39 38
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
40 39
 
41 40
 import java.util.Arrays;
@@ -60,12 +59,10 @@ public class ProcessJoin extends IRCProcessor {
60 59
      * @param prefixModeManager The manager to use to access prefix modes.
61 60
      * @param userModeManager Mode manager to use for user modes.
62 61
      * @param chanModeManager Mode manager to use for channel modes.
63
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
64 62
      */
65 63
     public ProcessJoin(final IRCParser parser, final PrefixModeManager prefixModeManager,
66
-            final ModeManager userModeManager, final ModeManager chanModeManager,
67
-            final ProcessingManager manager) {
68
-        super(parser, manager, "JOIN", "329");
64
+            final ModeManager userModeManager, final ModeManager chanModeManager) {
65
+        super(parser, "JOIN", "329");
69 66
         this.prefixModeManager = prefixModeManager;
70 67
         this.userModeManager = userModeManager;
71 68
         this.chanModeManager = chanModeManager;

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessKick.java Просмотреть файл

@@ -30,7 +30,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCChannelInfo;
31 31
 import com.dmdirc.parser.irc.IRCClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33
-import com.dmdirc.parser.irc.ProcessingManager;
34 33
 
35 34
 import java.util.Arrays;
36 35
 import java.util.Date;
@@ -44,10 +43,9 @@ public class ProcessKick extends IRCProcessor {
44 43
      * Create a new instance of the IRCProcessor Object.
45 44
      *
46 45
      * @param parser IRCParser That owns this IRCProcessor
47
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
48 46
      */
49
-    public ProcessKick(final IRCParser parser, final ProcessingManager manager) {
50
-        super(parser, manager, "KICK");
47
+    public ProcessKick(final IRCParser parser) {
48
+        super(parser, "KICK");
51 49
     }
52 50
 
53 51
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessList.java Просмотреть файл

@@ -26,7 +26,6 @@ import com.dmdirc.parser.events.GroupListEndEvent;
26 26
 import com.dmdirc.parser.events.GroupListEntryEvent;
27 27
 import com.dmdirc.parser.events.GroupListStartEvent;
28 28
 import com.dmdirc.parser.irc.IRCParser;
29
-import com.dmdirc.parser.irc.ProcessingManager;
30 29
 
31 30
 import java.util.Date;
32 31
 
@@ -39,10 +38,9 @@ public class ProcessList extends IRCProcessor {
39 38
      * Create a new instance of the IRCProcessor Object.
40 39
      *
41 40
      * @param parser IRCParser That owns this IRCProcessor
42
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
43 41
      */
44
-    public ProcessList(final IRCParser parser, final ProcessingManager manager) {
45
-        super(parser, manager, "321", "322", "323");
42
+    public ProcessList(final IRCParser parser) {
43
+        super(parser, "321", "322", "323");
46 44
     }
47 45
 
48 46
     /**

+ 2
- 5
irc/src/com/dmdirc/parser/irc/processors/ProcessListModes.java Просмотреть файл

@@ -27,7 +27,6 @@ import com.dmdirc.parser.events.ChannelListModeEvent;
27 27
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 28
 import com.dmdirc.parser.irc.IRCChannelInfo;
29 29
 import com.dmdirc.parser.irc.IRCParser;
30
-import com.dmdirc.parser.irc.ProcessingManager;
31 30
 import com.dmdirc.parser.irc.ServerType;
32 31
 import com.dmdirc.parser.irc.ServerTypeGroup;
33 32
 
@@ -45,11 +44,9 @@ public class ProcessListModes extends IRCProcessor {
45 44
      * Create a new instance of the IRCProcessor Object.
46 45
      *
47 46
      * @param parser IRCParser That owns this IRCProcessor
48
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
49 47
      */
50
-    public ProcessListModes(final IRCParser parser, final ProcessingManager manager) {
51
-        super(parser, manager,
52
-                "367", "368", /* Bans */
48
+    public ProcessListModes(final IRCParser parser) {
49
+        super(parser, "367", "368", /* Bans */
53 50
                 "344", "345", /* Reop list (ircnet) or bad words (euirc) */
54 51
                 "346", "347", /* Invite List */
55 52
                 "348", "349", /* Except/Exempt List */

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessMOTD.java Просмотреть файл

@@ -26,7 +26,6 @@ import com.dmdirc.parser.events.MOTDEndEvent;
26 26
 import com.dmdirc.parser.events.MOTDLineEvent;
27 27
 import com.dmdirc.parser.events.MOTDStartEvent;
28 28
 import com.dmdirc.parser.irc.IRCParser;
29
-import com.dmdirc.parser.irc.ProcessingManager;
30 29
 
31 30
 import java.util.Date;
32 31
 
@@ -39,10 +38,9 @@ public class ProcessMOTD extends IRCProcessor {
39 38
      * Create a new instance of the IRCProcessor Object.
40 39
      *
41 40
      * @param parser IRCParser That owns this IRCProcessor
42
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
43 41
      */
44
-    public ProcessMOTD(final IRCParser parser, final ProcessingManager manager) {
45
-        super(parser, manager, "372", "375", "376", "422");
42
+    public ProcessMOTD(final IRCParser parser) {
43
+        super(parser, "372", "375", "376", "422");
46 44
     }
47 45
 
48 46
     /**

+ 2
- 5
irc/src/com/dmdirc/parser/irc/processors/ProcessMessage.java Просмотреть файл

@@ -49,7 +49,6 @@ import com.dmdirc.parser.irc.IRCChannelInfo;
49 49
 import com.dmdirc.parser.irc.IRCClientInfo;
50 50
 import com.dmdirc.parser.irc.IRCParser;
51 51
 import com.dmdirc.parser.irc.PrefixModeManager;
52
-import com.dmdirc.parser.irc.ProcessingManager;
53 52
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
54 53
 import com.dmdirc.parser.irc.TimestampedIRCProcessor;
55 54
 
@@ -74,11 +73,9 @@ public class ProcessMessage extends TimestampedIRCProcessor {
74 73
      *
75 74
      * @param parser IRCParser That owns this IRCProcessor
76 75
      * @param prefixModeManager The manager to use to access prefix modes.
77
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
78 76
      */
79
-    public ProcessMessage(final IRCParser parser, final PrefixModeManager prefixModeManager,
80
-            final ProcessingManager manager) {
81
-        super(parser, manager, "PRIVMSG", "NOTICE");
77
+    public ProcessMessage(final IRCParser parser, final PrefixModeManager prefixModeManager) {
78
+        super(parser, "PRIVMSG", "NOTICE");
82 79
         this.prefixModeManager = prefixModeManager;
83 80
     }
84 81
 

+ 2
- 5
irc/src/com/dmdirc/parser/irc/processors/ProcessMode.java Просмотреть файл

@@ -39,7 +39,6 @@ import com.dmdirc.parser.irc.IRCClientInfo;
39 39
 import com.dmdirc.parser.irc.IRCParser;
40 40
 import com.dmdirc.parser.irc.ModeManager;
41 41
 import com.dmdirc.parser.irc.PrefixModeManager;
42
-import com.dmdirc.parser.irc.ProcessingManager;
43 42
 
44 43
 import java.util.Calendar;
45 44
 import java.util.Date;
@@ -63,12 +62,10 @@ public class ProcessMode extends IRCProcessor {
63 62
      * @param prefixModeManager The manager to use to access prefix modes.
64 63
      * @param userModeManager Mode manager to use for user modes.
65 64
      * @param chanModeManager Mode manager to use for channel modes.
66
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
67 65
      */
68 66
     public ProcessMode(final IRCParser parser, final PrefixModeManager prefixModeManager,
69
-            final ModeManager userModeManager, final ModeManager chanModeManager,
70
-            final ProcessingManager manager) {
71
-        super(parser, manager, "MODE", "324", "221");
67
+            final ModeManager userModeManager, final ModeManager chanModeManager) {
68
+        super(parser, "MODE", "324", "221");
72 69
         this.prefixModeManager = prefixModeManager;
73 70
         this.userModeManager = userModeManager;
74 71
         this.chanModeManager = chanModeManager;

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNames.java Просмотреть файл

@@ -31,7 +31,6 @@ import com.dmdirc.parser.irc.IRCClientInfo;
31 31
 import com.dmdirc.parser.irc.IRCParser;
32 32
 import com.dmdirc.parser.irc.ModeManager;
33 33
 import com.dmdirc.parser.irc.PrefixModeManager;
34
-import com.dmdirc.parser.irc.ProcessingManager;
35 34
 
36 35
 import java.util.Date;
37 36
 
@@ -51,11 +50,10 @@ public class ProcessNames extends IRCProcessor {
51 50
      * @param parser IRCParser That owns this IRCProcessor
52 51
      * @param prefixModeManager The manager to use to access prefix modes.
53 52
      * @param userModeManager Mode manager to use for user modes.
54
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
55 53
      */
56 54
     public ProcessNames(final IRCParser parser, final PrefixModeManager prefixModeManager,
57
-            final ModeManager userModeManager, final ProcessingManager manager) {
58
-        super(parser, manager, "353", "366");
55
+            final ModeManager userModeManager) {
56
+        super(parser, "353", "366");
59 57
         this.prefixModeManager = prefixModeManager;
60 58
         this.userModeManager = userModeManager;
61 59
     }

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNick.java Просмотреть файл

@@ -32,7 +32,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 import com.dmdirc.parser.irc.IRCClientInfo;
34 34
 import com.dmdirc.parser.irc.IRCParser;
35
-import com.dmdirc.parser.irc.ProcessingManager;
36 35
 
37 36
 import java.util.Date;
38 37
 
@@ -45,10 +44,9 @@ public class ProcessNick extends IRCProcessor {
45 44
      * Create a new instance of the IRCProcessor Object.
46 45
      *
47 46
      * @param parser IRCParser That owns this IRCProcessor
48
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
49 47
      */
50
-    public ProcessNick(final IRCParser parser, final ProcessingManager manager) {
51
-        super(parser, manager, "NICK");
48
+    public ProcessNick(final IRCParser parser) {
49
+        super(parser, "NICK");
52 50
     }
53 51
 
54 52
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNickInUse.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.events.NickInUseEvent;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 
29 28
 import java.util.Date;
30 29
 
@@ -43,10 +42,9 @@ public class ProcessNickInUse extends IRCProcessor {
43 42
      * Create a new instance of the ProcessNickInUse Object.
44 43
      *
45 44
      * @param parser IRCParser That owns this object
46
-     * @param manager ProcessingManager that is in charge of this object
47 45
      */
48
-    public ProcessNickInUse(final IRCParser parser, final ProcessingManager manager) {
49
-        super(parser, manager, "433");
46
+    public ProcessNickInUse(final IRCParser parser) {
47
+        super(parser, "433");
50 48
     }
51 49
 
52 50
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java Просмотреть файл

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.events.AuthNoticeEvent;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.ProcessingManager;
28 27
 
29 28
 import java.util.Date;
30 29
 
@@ -37,10 +36,9 @@ public class ProcessNoticeAuth extends IRCProcessor {
37 36
      * Create a new instance of the ProcessNoticeAuth Object.
38 37
      *
39 38
      * @param parser IRCParser That owns this object
40
-     * @param manager ProcessingManager that is in charge of this object
41 39
      */
42
-    public ProcessNoticeAuth(final IRCParser parser, final ProcessingManager manager) {
43
-        super(parser, manager, "Notice Auth");
40
+    public ProcessNoticeAuth(final IRCParser parser) {
41
+        super(parser, "Notice Auth");
44 42
     }
45 43
 
46 44
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessPart.java Просмотреть файл

@@ -30,7 +30,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCChannelInfo;
31 31
 import com.dmdirc.parser.irc.IRCClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33
-import com.dmdirc.parser.irc.ProcessingManager;
34 33
 
35 34
 import java.util.Date;
36 35
 
@@ -43,10 +42,9 @@ public class ProcessPart extends IRCProcessor {
43 42
      * Create a new instance of the IRCProcessor Object.
44 43
      *
45 44
      * @param parser IRCParser That owns this IRCProcessor
46
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
47 45
      */
48
-    public ProcessPart(final IRCParser parser, final ProcessingManager manager) {
49
-        super(parser, manager, "PART");
46
+    public ProcessPart(final IRCParser parser) {
47
+        super(parser, "PART");
50 48
     }
51 49
 
52 50
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessQuit.java Просмотреть файл

@@ -31,7 +31,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
31 31
 import com.dmdirc.parser.irc.IRCChannelInfo;
32 32
 import com.dmdirc.parser.irc.IRCClientInfo;
33 33
 import com.dmdirc.parser.irc.IRCParser;
34
-import com.dmdirc.parser.irc.ProcessingManager;
35 34
 
36 35
 import java.util.ArrayList;
37 36
 import java.util.Date;
@@ -45,10 +44,9 @@ public class ProcessQuit extends IRCProcessor {
45 44
      * Create a new instance of the IRCProcessor Object.
46 45
      *
47 46
      * @param parser IRCParser That owns this IRCProcessor
48
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
49 47
      */
50
-    public ProcessQuit(final IRCParser parser, final ProcessingManager manager) {
51
-        super(parser, manager, "QUIT");
48
+    public ProcessQuit(final IRCParser parser) {
49
+        super(parser, "QUIT");
52 50
     }
53 51
 
54 52
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessTopic.java Просмотреть файл

@@ -27,7 +27,6 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
27 27
 import com.dmdirc.parser.irc.IRCChannelInfo;
28 28
 import com.dmdirc.parser.irc.IRCClientInfo;
29 29
 import com.dmdirc.parser.irc.IRCParser;
30
-import com.dmdirc.parser.irc.ProcessingManager;
31 30
 
32 31
 import java.util.Date;
33 32
 
@@ -40,10 +39,9 @@ public class ProcessTopic extends IRCProcessor {
40 39
      * Create a new instance of the IRCProcessor Object.
41 40
      *
42 41
      * @param parser IRCParser That owns this IRCProcessor
43
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
44 42
      */
45
-    public ProcessTopic(final IRCParser parser, final ProcessingManager manager) {
46
-        super(parser, manager, "TOPIC", "332", "333");
43
+    public ProcessTopic(final IRCParser parser) {
44
+        super(parser, "TOPIC", "332", "333");
47 45
     }
48 46
 
49 47
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessWallops.java Просмотреть файл

@@ -26,7 +26,6 @@ import com.dmdirc.parser.events.WallDesyncEvent;
26 26
 import com.dmdirc.parser.events.WallopEvent;
27 27
 import com.dmdirc.parser.events.WalluserEvent;
28 28
 import com.dmdirc.parser.irc.IRCParser;
29
-import com.dmdirc.parser.irc.ProcessingManager;
30 29
 
31 30
 import java.util.Date;
32 31
 
@@ -39,10 +38,9 @@ public class ProcessWallops extends IRCProcessor {
39 38
      * Create a new instance of the IRCProcessor Object.
40 39
      *
41 40
      * @param parser IRCParser That owns this IRCProcessor
42
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
43 41
      */
44
-    public ProcessWallops(final IRCParser parser, final ProcessingManager manager) {
45
-        super(parser, manager, "WALLOPS");
42
+    public ProcessWallops(final IRCParser parser) {
43
+        super(parser, "WALLOPS");
46 44
     }
47 45
 
48 46
     /**

+ 2
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessWho.java Просмотреть файл

@@ -31,7 +31,6 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
31 31
 import com.dmdirc.parser.interfaces.ClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCClientInfo;
33 33
 import com.dmdirc.parser.irc.IRCParser;
34
-import com.dmdirc.parser.irc.ProcessingManager;
35 34
 
36 35
 import java.util.Date;
37 36
 
@@ -44,10 +43,9 @@ public class ProcessWho extends IRCProcessor {
44 43
      * Create a new instance of the IRCProcessor Object.
45 44
      *
46 45
      * @param parser IRCParser That owns this IRCProcessor
47
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
48 46
      */
49
-    public ProcessWho(final IRCParser parser, final ProcessingManager manager) {
50
-        super(parser, manager, "352");
47
+    public ProcessWho(final IRCParser parser) {
48
+        super(parser, "352");
51 49
     }
52 50
 
53 51
     /**

+ 0
- 346
irc/test/com/dmdirc/parser/irc/IRCParserTest.java Просмотреть файл

@@ -1,346 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.common.MyInfo;
28
-import com.dmdirc.parser.interfaces.callbacks.AuthNoticeListener;
29
-import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
30
-import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
31
-import com.dmdirc.parser.interfaces.callbacks.ConnectErrorListener;
32
-import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
33
-import com.dmdirc.parser.interfaces.callbacks.NumericListener;
34
-import com.dmdirc.parser.interfaces.callbacks.ServerErrorListener;
35
-import com.dmdirc.parser.interfaces.callbacks.ServerReadyListener;
36
-
37
-import java.net.URI;
38
-import java.net.URISyntaxException;
39
-import java.util.Arrays;
40
-
41
-import javax.net.ssl.TrustManager;
42
-
43
-import org.junit.Ignore;
44
-import org.junit.Test;
45
-
46
-import static org.junit.Assert.assertEquals;
47
-import static org.junit.Assert.assertFalse;
48
-import static org.junit.Assert.assertTrue;
49
-import static org.mockito.Mockito.anyObject;
50
-import static org.mockito.Mockito.anyString;
51
-import static org.mockito.Mockito.eq;
52
-import static org.mockito.Mockito.mock;
53
-import static org.mockito.Mockito.never;
54
-import static org.mockito.Mockito.same;
55
-import static org.mockito.Mockito.verify;
56
-
57
-@Ignore
58
-public class IRCParserTest {
59
-
60
-    private interface TestCallback extends CallbackInterface { }
61
-
62
-    @Test(expected=CallbackNotFoundException.class)
63
-    public void testIssue42() {
64
-        // Invalid callback names are silently ignored instead of raising exceptions
65
-        final IRCParser myParser = new IRCParser();
66
-    }
67
-
68
-    @Test
69
-    public void testIssue1674() {
70
-        // parser nick change error with dual 001
71
-        final ErrorInfoListener error = mock(ErrorInfoListener.class);
72
-
73
-        final TestParser myParser = new TestParser();
74
-        myParser.injectConnectionStrings();
75
-        myParser.nick = "nick2";
76
-        myParser.injectConnectionStrings();
77
-        myParser.injectLine(":nick2!ident@host NICK :nick");
78
-
79
-        verify(error, never()).onErrorInfo(same(myParser), anyObject(), anyObject());
80
-    }
81
-
82
-    @Test
83
-    public void testTokeniser() {
84
-        final String line1 = "a b c d e";
85
-        final String line2 = "a b c :d e";
86
-        final String line3 = ":a b:c :d e";
87
-        final String line4 = null;
88
-
89
-        final String[] res1 = IRCParser.tokeniseLine(line1);
90
-        final String[] res2 = IRCParser.tokeniseLine(line2);
91
-        final String[] res3 = IRCParser.tokeniseLine(line3);
92
-        final String[] res4 = IRCParser.tokeniseLine(line4);
93
-
94
-        assertTrue(Arrays.equals(res1, new String[]{"a", "b", "c", "d", "e"}));
95
-        assertTrue(Arrays.equals(res2, new String[]{"a", "b", "c", "d e"}));
96
-        assertTrue(Arrays.equals(res3, new String[]{":a", "b:c", "d e"}));
97
-        assertTrue(Arrays.equals(res4, new String[]{""}));
98
-    }
99
-
100
-    @Test
101
-    public void testSendConnectionStrings1() throws URISyntaxException {
102
-        final MyInfo myInfo = new MyInfo();
103
-        myInfo.setNickname("Nickname");
104
-        myInfo.setRealname("Real name");
105
-        myInfo.setUsername("Username");
106
-
107
-        final TestParser parser = new TestParser(myInfo, new URI("irc://irc.testing.dmdirc:6667/"));
108
-        parser.sendConnectionStrings();
109
-
110
-        assertEquals(3, parser.sentLines.size());
111
-
112
-        assertTrue("Should send CAP LS line",
113
-                Arrays.equals(parser.getLine(0), new String[]{"CAP", "LS"}));
114
-
115
-        assertTrue("Should send nickname line",
116
-                Arrays.equals(parser.getLine(1), new String[]{"NICK", "Nickname"}));
117
-
118
-        final String[] userParts = parser.getLine(2);
119
-        assertEquals("First token should be USER", "USER", userParts[0]);
120
-        assertEquals("USER should contain username", myInfo.getUsername().toLowerCase(),
121
-                userParts[1].toLowerCase());
122
-        assertEquals("USER should contain server name", "irc.testing.dmdirc", userParts[3]);
123
-        assertEquals("USER should contain real name", "Real name", userParts[4]);
124
-    }
125
-
126
-    @Test
127
-    public void testSendConnectionStrings2() throws URISyntaxException {
128
-        final MyInfo myInfo = new MyInfo();
129
-        myInfo.setNickname("Nickname");
130
-        myInfo.setRealname("Real name");
131
-        myInfo.setUsername("Username");
132
-
133
-        final TestParser parser = new TestParser(myInfo, new URI("irc://password@irc.testing.dmdirc:6667/"));
134
-        parser.sendConnectionStrings();
135
-
136
-        assertEquals(4, parser.sentLines.size());
137
-
138
-        assertTrue("Should send password line",
139
-                Arrays.equals(parser.getLine(1), new String[]{"PASS", "password"}));
140
-    }
141
-
142
-    @Test
143
-    public void testPingPong() {
144
-        final TestParser parser = new TestParser();
145
-
146
-        parser.injectLine("PING :flubadee7291");
147
-
148
-        assertTrue("Should reply to PINGs with PONGs",
149
-                Arrays.equals(parser.getLine(0), new String[]{"PONG", "flubadee7291"}));
150
-    }
151
-
152
-    @Test
153
-    public void testError() throws CallbackNotFoundException {
154
-        final ServerErrorListener test = mock(ServerErrorListener.class);
155
-
156
-        final TestParser parser = new TestParser();
157
-        parser.injectLine("ERROR :You smell of cheese");
158
-
159
-        verify(test).onServerError(same(parser), anyObject(), eq("You smell of cheese"));
160
-    }
161
-
162
-    @Test
163
-    public void testAuthNotice() throws CallbackNotFoundException {
164
-        final AuthNoticeListener test = mock(AuthNoticeListener.class);
165
-        final TestParser parser = new TestParser();
166
-        parser.sendConnectionStrings();
167
-
168
-        parser.injectLine("NOTICE AUTH :Random auth notice?");
169
-        verify(test).onNoticeAuth(same(parser), anyObject(), eq("Random auth notice?"));
170
-    }
171
-
172
-    @Test
173
-    public void testAuthNoticeTwenty() throws CallbackNotFoundException {
174
-        final AuthNoticeListener test = mock(AuthNoticeListener.class);
175
-        final TestParser parser = new TestParser();
176
-        parser.sendConnectionStrings();
177
-
178
-        parser.injectLine(":us.ircnet.org 020 * :Stupid notice");
179
-        verify(test).onNoticeAuth(same(parser), anyObject(), eq("Stupid notice"));
180
-    }
181
-
182
-    @Test
183
-    public void testPre001NickChange() throws CallbackNotFoundException {
184
-        final AuthNoticeListener test = mock(AuthNoticeListener.class);
185
-        final TestParser parser = new TestParser();
186
-        parser.sendConnectionStrings();
187
-        parser.injectLine(":chris!@ NICK :user2");
188
-
189
-        verify(test, never()).onNoticeAuth(anyObject(), anyObject(), anyString());
190
-    }
191
-
192
-    @Test
193
-    public void testNumeric() throws CallbackNotFoundException {
194
-        final NumericListener test = mock(NumericListener.class);
195
-        final TestParser parser = new TestParser();
196
-
197
-        parser.injectLine(":server 001 nick :Hi there, nick");
198
-
199
-        verify(test).onNumeric(same(parser), anyObject(), eq(1),
200
-                eq(new String[]{":server", "001", "nick", "Hi there, nick"}));
201
-    }
202
-
203
-    @Test
204
-    public void testServerReady() throws CallbackNotFoundException {
205
-        final ServerReadyListener test = mock(ServerReadyListener.class);
206
-        final TestParser parser = new TestParser();
207
-
208
-        final String[] strings = {
209
-            "NOTICE AUTH :Blah, blah",
210
-            ":server 020 * :Blah! Blah!",
211
-            ":server 001 nick :Welcome to the Testing IRC Network, nick",
212
-            ":server 002 nick :Your host is server.net, running version foo",
213
-            "NOTICE AUTH :I'm a retarded server",
214
-            ":server 003 nick :This server was created Sun Jan 6 2008 at 17:34:54 CET",
215
-            ":server 004 nick server.net foo dioswkgxRXInP biklmnopstvrDcCNuMT bklov",
216
-            ":server 005 nick WHOX WALLCHOPS WALLVOICES USERIP :are supported by this server",
217
-            ":server 005 nick MAXNICKLEN=15 TOPICLEN=250 AWAYLEN=160 :are supported " +
218
-                    "by this server",
219
-            ":server 375 nick :zomg, motd!",
220
-        };
221
-
222
-        for (String string : strings) {
223
-            verify(test, never()).onServerReady(anyObject(), anyObject());
224
-            parser.injectLine(string);
225
-        }
226
-
227
-        verify(test).onServerReady(same(parser), anyObject());
228
-    }
229
-
230
-    @Test
231
-    public void test005Parsing() {
232
-        final TestParser parser = new TestParser();
233
-
234
-        final String[] strings = {
235
-            ":server 001 nick :Welcome to the Testing IRC Network, nick",
236
-            ":server 002 nick :Your host is server.net, running version foo",
237
-            ":server 003 nick :This server was created Sun Jan 6 2008 at 17:34:54 CET",
238
-            ":server 004 nick server.net foo dioswkgxRXInP biklmnopstvrDcCNuMT bklov",
239
-            ":server 005 nick WHOX WALLCHOPS WALLVOICES NETWORK=moo :are supported by" +
240
-                    " this server",
241
-            ":server 005 nick MAXNICKLEN=15 MAXLIST=b:10,e:22,I:45 :are supported by" +
242
-                    " this server",
243
-            ":server 375 nick :zomg, motd!",
244
-        };
245
-
246
-        for (String string : strings) {
247
-            parser.injectLine(string);
248
-        }
249
-
250
-        assertEquals(10, parser.getMaxListModes('b'));
251
-        assertEquals(22, parser.getMaxListModes('e'));
252
-        assertEquals(45, parser.getMaxListModes('I'));
253
-        assertEquals("getMaxListModes should return 0 for unknowns;", 0,
254
-                parser.getMaxListModes('z'));
255
-        assertEquals("moo", parser.getNetworkName());
256
-        assertEquals("server", parser.getServerName());
257
-    }
258
-
259
-    @Test
260
-    public void testBindIP() {
261
-        final TestParser parser = new TestParser();
262
-
263
-        parser.setBindIP("abc.def.ghi.123");
264
-        assertEquals("abc.def.ghi.123", parser.getBindIP());
265
-    }
266
-
267
-    @Test
268
-    public void testAutoListMode() {
269
-        final TestParser parser = new TestParser();
270
-
271
-        parser.setAutoListMode(false);
272
-        assertFalse(parser.getAutoListMode());
273
-        parser.setAutoListMode(true);
274
-        assertTrue(parser.getAutoListMode());
275
-    }
276
-
277
-    @Test
278
-    public void testRemoveAfterCallback() {
279
-        final TestParser parser = new TestParser();
280
-
281
-        parser.setRemoveAfterCallback(false);
282
-        assertFalse(parser.getRemoveAfterCallback());
283
-        parser.setRemoveAfterCallback(true);
284
-        assertTrue(parser.getRemoveAfterCallback());
285
-    }
286
-
287
-    @Test
288
-    public void testAddLastLine() {
289
-        final TestParser parser = new TestParser();
290
-
291
-        parser.setAddLastLine(false);
292
-        assertFalse(parser.getAddLastLine());
293
-        parser.setAddLastLine(true);
294
-        assertTrue(parser.getAddLastLine());
295
-    }
296
-
297
-    @Test
298
-    public void testDisconnectOnFatal() {
299
-        final TestParser parser = new TestParser();
300
-
301
-        parser.setDisconnectOnFatal(false);
302
-        assertFalse(parser.getDisconnectOnFatal());
303
-        parser.setDisconnectOnFatal(true);
304
-        assertTrue(parser.getDisconnectOnFatal());
305
-    }
306
-
307
-    @Test
308
-    public void testTrustManager() {
309
-        final TestParser parser = new TestParser();
310
-
311
-        assertTrue(Arrays.equals(parser.getDefaultTrustManager(), parser.getTrustManager()));
312
-
313
-        parser.setTrustManagers(new TrustManager[0]);
314
-
315
-        assertTrue(Arrays.equals(new TrustManager[0], parser.getTrustManager()));
316
-    }
317
-
318
-    @Test
319
-    public void testGetParam() {
320
-        assertEquals("abc def", TestParser.getParam("foo :abc def"));
321
-        assertEquals("bar :abc def", TestParser.getParam("foo :bar :abc def"));
322
-        assertEquals("abc def", TestParser.getParam("abc def"));
323
-    }
324
-
325
-    @Test
326
-    public void testKick() throws CallbackNotFoundException {
327
-        final TestParser parser = new TestParser();
328
-        final ChannelKickListener ick = mock(ChannelKickListener.class);
329
-        parser.injectConnectionStrings();
330
-
331
-        parser.injectLine(":nick JOIN #D");
332
-        parser.injectLine(":bar!me@moo KICK #D nick :Bye!");
333
-
334
-        verify(ick).onChannelKick(same(parser), anyObject(), anyObject(), anyObject(), anyObject(),
335
-                anyString(), anyString());
336
-    }
337
-
338
-    @Test
339
-    public void testIllegalPort2() throws URISyntaxException {
340
-        final TestParser tp = new TestParser(new MyInfo(), new URI("irc://127.0.0.1:65570/"));
341
-        final ConnectErrorListener tiei = mock(ConnectErrorListener.class);
342
-        tp.runSuper();
343
-        verify(tiei).onConnectError(same(tp), anyObject(), anyObject());
344
-    }
345
-
346
-}

+ 1
- 1
irc/test/com/dmdirc/parser/irc/processors/Process001Test.java Просмотреть файл

@@ -60,7 +60,7 @@ public class Process001Test {
60 60
     @Before
61 61
     public void setup() {
62 62
         when(parser.getLocalClient()).thenReturn(localClient);
63
-        processor = new Process001(parser, processingManager);
63
+        processor = new Process001(parser);
64 64
     }
65 65
 
66 66
     @Test

+ 0
- 80
irc/test/com/dmdirc/parser/irc/processors/Process004005Test.java Просмотреть файл

@@ -1,80 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.ParserError;
27
-import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
28
-import com.dmdirc.parser.irc.IRCEncoding;
29
-
30
-import java.util.Date;
31
-
32
-import org.junit.Ignore;
33
-import org.junit.Test;
34
-
35
-import static org.junit.Assert.*;
36
-import static org.mockito.Mockito.*;
37
-
38
-@Ignore
39
-public class Process004005Test {
40
-
41
-    private TestParser doCaseMappingTest(final String target, final IRCEncoding expected) {
42
-        final TestParser parser = new TestParser();
43
-        parser.injectConnectionStrings();
44
-        parser.injectLine(":server 005 nick CASEMAPPING=" + target
45
-                    + " :are supported by this server");
46
-
47
-        assertEquals(expected, parser.getStringConverter().getEncoding());
48
-
49
-        return parser;
50
-    }
51
-
52
-    @Test
53
-    public void testCaseMappingASCII() {
54
-        doCaseMappingTest("ascii", IRCEncoding.ASCII);
55
-        doCaseMappingTest("ASCII", IRCEncoding.ASCII);
56
-    }
57
-
58
-    @Test
59
-    public void testCaseMappingRFC() {
60
-        doCaseMappingTest("rfc1459", IRCEncoding.RFC1459);
61
-        doCaseMappingTest("RFC1459", IRCEncoding.RFC1459);
62
-    }
63
-
64
-    @Test
65
-    public void testCaseMappingStrict() {
66
-        doCaseMappingTest("strict-rfc1459", IRCEncoding.STRICT_RFC1459);
67
-        doCaseMappingTest("strict-RFC1459", IRCEncoding.STRICT_RFC1459);
68
-    }
69
-
70
-    @Test
71
-    public void testCaseMappingUnknown() {
72
-        final TestParser tp = doCaseMappingTest("rfc1459", IRCEncoding.RFC1459);
73
-        final ErrorInfoListener info = mock(ErrorInfoListener.class);
74
-
75
-        tp.injectLine(":server 005 nick CASEMAPPING=unknown :are supported by this server");
76
-
77
-        verify(info).onErrorInfo(same(tp), (Date) anyObject(), (ParserError) anyObject());
78
-    }
79
-
80
-}

+ 8
- 8
irc/test/com/dmdirc/parser/irc/processors/Process464Test.java Просмотреть файл

@@ -23,42 +23,42 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.CallbackManager;
26
-import com.dmdirc.parser.interfaces.callbacks.PasswordRequiredListener;
26
+import com.dmdirc.parser.events.PasswordRequiredEvent;
27 27
 import com.dmdirc.parser.irc.IRCParser;
28 28
 import com.dmdirc.parser.irc.ProcessingManager;
29 29
 
30 30
 import org.junit.Before;
31
-import org.junit.Ignore;
32 31
 import org.junit.Test;
33 32
 import org.junit.runner.RunWith;
33
+import org.mockito.ArgumentCaptor;
34
+import org.mockito.Captor;
34 35
 import org.mockito.Mock;
35 36
 import org.mockito.runners.MockitoJUnitRunner;
36 37
 
37
-import static org.mockito.Matchers.anyObject;
38
-import static org.mockito.Matchers.same;
38
+import static org.junit.Assert.assertSame;
39 39
 import static org.mockito.Mockito.verify;
40 40
 import static org.mockito.Mockito.when;
41 41
 
42 42
 @RunWith(MockitoJUnitRunner.class)
43
-@Ignore
44 43
 public class Process464Test {
45 44
 
46 45
     @Mock private IRCParser parser;
47 46
     @Mock private ProcessingManager processingManager;
48 47
     @Mock private CallbackManager callbackManager;
49
-    @Mock private PasswordRequiredListener listener;
48
+    @Captor private ArgumentCaptor<PasswordRequiredEvent> eventCaptor;
50 49
     private Process464 processor;
51 50
 
52 51
     @Before
53 52
     public void setup() {
54 53
         when(parser.getCallbackManager()).thenReturn(callbackManager);
55
-        processor = new Process464(parser, processingManager);
54
+        processor = new Process464(parser);
56 55
     }
57 56
 
58 57
     @Test
59 58
     public void testFiresPasswordListenerOn464() {
60 59
         processor.process("464", ":server.com", "464", ":Bad password!");
61
-        verify(listener).onPasswordRequired(same(parser), anyObject());
60
+        verify(callbackManager).publish(eventCaptor.capture());
61
+        assertSame(parser, eventCaptor.getValue().getParser());
62 62
     }
63 63
 
64 64
 }

+ 0
- 65
irc/test/com/dmdirc/parser/irc/processors/ProcessJoinTest.java Просмотреть файл

@@ -1,65 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.callbacks.ChannelJoinListener;
28
-import com.dmdirc.parser.interfaces.callbacks.ChannelSelfJoinListener;
29
-import java.util.Date;
30
-
31
-import org.junit.Ignore;
32
-import org.junit.Test;
33
-import static org.mockito.Mockito.*;
34
-
35
-@Ignore
36
-public class ProcessJoinTest {
37
-    
38
-    @Test
39
-    public void testSelfJoinChannel() throws CallbackNotFoundException {
40
-        final TestParser parser = new TestParser();
41
-        final ChannelSelfJoinListener test = mock(ChannelSelfJoinListener.class);
42
-
43
-        parser.injectConnectionStrings();
44
-        parser.injectLine(":nick JOIN #DMDirc_testing");
45
-
46
-        verify(test).onChannelSelfJoin(same(parser), (Date) anyObject(),
47
-                same(parser.getChannel("#DMDirc_testing")));
48
-    }
49
-    
50
-    @Test
51
-    public void testOtherJoinChannel() throws CallbackNotFoundException {
52
-        final TestParser parser = new TestParser();
53
-        final ChannelJoinListener test = mock(ChannelJoinListener.class);
54
-
55
-        parser.injectConnectionStrings();
56
-        
57
-        parser.injectLine(":nick JOIN #DMDirc_testing");
58
-        parser.injectLine(":foo!bar@baz JOIN #DMDirc_testing");
59
-
60
-        verify(test).onChannelJoin(same(parser), (Date) anyObject(),
61
-                same(parser.getChannel("#DMDirc_testing")),
62
-                same(parser.getClient("foo!bar@baz").getChannelClients().get(0)));
63
-    }    
64
-
65
-}

+ 0
- 94
irc/test/com/dmdirc/parser/irc/processors/ProcessMessageTest.java Просмотреть файл

@@ -1,94 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.Parser;
28
-import com.dmdirc.parser.interfaces.callbacks.PrivateActionListener;
29
-import com.dmdirc.parser.interfaces.callbacks.PrivateCtcpListener;
30
-import com.dmdirc.parser.interfaces.callbacks.PrivateMessageListener;
31
-import java.util.Date;
32
-
33
-import org.junit.Ignore;
34
-import org.junit.Test;
35
-import static org.mockito.Mockito.*;
36
-
37
-@Ignore
38
-public class ProcessMessageTest {
39
-
40
-    @Test
41
-    public void testPrivateMessage() throws CallbackNotFoundException {
42
-        final TestParser parser = new TestParser();
43
-        final PrivateMessageListener ipmtest = mock(PrivateMessageListener.class);
44
-        final PrivateActionListener ipatest = mock(PrivateActionListener.class);
45
-        final PrivateCtcpListener ipctest = mock(PrivateCtcpListener.class);
46
-
47
-        parser.injectConnectionStrings();
48
-
49
-        parser.injectLine(":a!b@c PRIVMSG nick :Hello!");
50
-        verify(ipmtest).onPrivateMessage(same(parser), (Date) anyObject(),
51
-                eq("Hello!"), eq("a!b@c"));
52
-        verify(ipatest, never()).onPrivateAction((Parser) anyObject(),
53
-                (Date) anyObject(), anyString(), anyString());
54
-        verify(ipctest, never()).onPrivateCTCP((Parser) anyObject(),
55
-                (Date) anyObject(), anyString(), anyString(), anyString());
56
-    }
57
-
58
-    @Test
59
-    public void testPrivateAction() throws CallbackNotFoundException {
60
-        final TestParser parser = new TestParser();
61
-        final PrivateMessageListener ipmtest = mock(PrivateMessageListener.class);
62
-        final PrivateActionListener ipatest = mock(PrivateActionListener.class);
63
-        final PrivateCtcpListener ipctest = mock(PrivateCtcpListener.class);
64
-
65
-        parser.injectConnectionStrings();
66
-
67
-        parser.injectLine(":a!b@c PRIVMSG nick :" + ((char) 1) + "ACTION meep" + ((char) 1));
68
-        verify(ipmtest, never()).onPrivateMessage((Parser) anyObject(),
69
-                (Date) anyObject(), anyString(), anyString());
70
-        verify(ipatest).onPrivateAction(same(parser), (Date) anyObject(),
71
-                eq("meep"), eq("a!b@c"));
72
-        verify(ipctest, never()).onPrivateCTCP((Parser) anyObject(),
73
-                (Date) anyObject(), anyString(), anyString(), anyString());
74
-    }
75
-
76
-    @Test
77
-    public void testPrivateCTCP() throws CallbackNotFoundException {
78
-        final TestParser parser = new TestParser();
79
-        final PrivateMessageListener ipmtest = mock(PrivateMessageListener.class);
80
-        final PrivateActionListener ipatest = mock(PrivateActionListener.class);
81
-        final PrivateCtcpListener ipctest = mock(PrivateCtcpListener.class);
82
-
83
-        parser.injectConnectionStrings();
84
-
85
-        parser.injectLine(":a!b@c PRIVMSG nick :" + ((char) 1) + "FOO meep" + ((char) 1));
86
-        verify(ipmtest, never()).onPrivateMessage((Parser) anyObject(),
87
-                (Date) anyObject(), anyString(), anyString());
88
-        verify(ipatest, never()).onPrivateAction((Parser) anyObject(),
89
-                (Date) anyObject(), anyString(), anyString());
90
-        verify(ipctest).onPrivateCTCP(same(parser),
91
-                (Date) anyObject(), eq("FOO"), eq("meep"), eq("a!b@c"));
92
-    }
93
-
94
-}

+ 0
- 81
irc/test/com/dmdirc/parser/irc/processors/ProcessNamesTest.java Просмотреть файл

@@ -1,81 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
-import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
29
-
30
-import org.junit.Ignore;
31
-import org.junit.Test;
32
-
33
-import static org.junit.Assert.assertEquals;
34
-import static org.junit.Assert.assertNotNull;
35
-import static org.mockito.Mockito.anyObject;
36
-import static org.mockito.Mockito.mock;
37
-import static org.mockito.Mockito.never;
38
-import static org.mockito.Mockito.verify;
39
-
40
-@Ignore
41
-public class ProcessNamesTest {
42
-    
43
-    @Test
44
-    public void testExternalNames() throws CallbackNotFoundException {
45
-        final TestParser parser = new TestParser();
46
-        final ErrorInfoListener test = mock(ErrorInfoListener.class);
47
-
48
-        parser.injectLine(":server 366 nick #nonexistant :End of /NAMES list.");
49
-        
50
-        verify(test, never()).onErrorInfo(anyObject(), anyObject(), anyObject());
51
-    }
52
-    
53
-    @Test
54
-    public void testChannelUmodes() {
55
-        final TestParser parser = new TestParser();
56
-
57
-        parser.injectConnectionStrings();
58
-        parser.injectLine(":nick JOIN #DMDirc_testing");
59
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser @+nick2 nick3");
60
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list");
61
-
62
-        assertEquals(1, parser.getChannels().size());
63
-        assertNotNull(parser.getChannel("#DMDirc_testing"));
64
-        assertEquals(4, parser.getChannel("#DMDirc_testing").getChannelClients().size());
65
-        assertNotNull(parser.getClient("luser"));
66
-        assertEquals(1, parser.getClient("luser").getChannelClients().size());
67
-
68
-        ChannelClientInfo cci = parser.getClient("luser").getChannelClients().get(0);
69
-        assertEquals(parser.getChannel("#DMDirc_testing"), cci.getChannel());
70
-        assertEquals("+", cci.getAllModesPrefix());
71
-        
72
-        cci = parser.getChannel("#DMDirc_testing").getChannelClient("nick2");
73
-        assertNotNull(cci);
74
-        assertEquals("@+", cci.getAllModesPrefix());
75
-
76
-        cci = parser.getChannel("#DMDirc_testing").getChannelClient("nick3");
77
-        assertNotNull(cci);
78
-        assertEquals("", cci.getAllModesPrefix());
79
-    }
80
-
81
-}

+ 0
- 115
irc/test/com/dmdirc/parser/irc/processors/ProcessNickTest.java Просмотреть файл

@@ -1,115 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
-import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
29
-import com.dmdirc.parser.interfaces.callbacks.NickChangeListener;
30
-
31
-import org.junit.Ignore;
32
-import org.junit.Test;
33
-
34
-import static org.junit.Assert.assertEquals;
35
-import static org.junit.Assert.assertFalse;
36
-import static org.junit.Assert.assertNotNull;
37
-import static org.mockito.Mockito.anyObject;
38
-import static org.mockito.Mockito.anyString;
39
-import static org.mockito.Mockito.eq;
40
-import static org.mockito.Mockito.mock;
41
-import static org.mockito.Mockito.never;
42
-import static org.mockito.Mockito.same;
43
-import static org.mockito.Mockito.verify;
44
-
45
-@Ignore
46
-public class ProcessNickTest {
47
-    
48
-    @Test
49
-    public void testNickSameName() {
50
-        final TestParser parser = new TestParser();
51
-        final NickChangeListener tinc = mock(NickChangeListener.class);
52
-        
53
-        parser.injectConnectionStrings();
54
-        parser.injectLine(":nick JOIN #DMDirc_testing");
55
-        parser.injectLine(":nick JOIN #DMDirc_testing2");
56
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser @+nick2 nick3");
57
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list");
58
-        parser.injectLine(":luser!lu@ser.com NICK LUSER");
59
-
60
-        assertNotNull(parser.getClient("LUSER"));
61
-        assertEquals(1, parser.getClient("LUSER").getChannelClients().size());
62
-
63
-        final ChannelClientInfo cci = parser.getClient("LUSER").getChannelClients().get(0);
64
-        assertEquals(parser.getChannel("#DMDirc_testing"), cci.getChannel());
65
-        assertEquals("+", cci.getAllModesPrefix());
66
-
67
-        verify(tinc).onNickChanged(same(parser), anyObject(),
68
-                same(parser.getClient("LUSER")), eq("luser"));
69
-    }
70
-    
71
-    @Test
72
-    public void testNickDifferent() {
73
-        final TestParser parser = new TestParser();
74
-
75
-        parser.injectConnectionStrings();
76
-        parser.injectLine(":nick JOIN #DMDirc_testing");
77
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser @+nick2 nick3");
78
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list");
79
-        parser.injectLine(":luser!lu@ser.com NICK foobar");
80
-
81
-        assertNotNull(parser.getClient("foobar"));
82
-        assertFalse(parser.isKnownClient("luser"));
83
-        assertEquals(1, parser.getClient("foobar").getChannelClients().size());
84
-
85
-        final ChannelClientInfo cci = parser.getClient("foobar").getChannelClients().get(0);
86
-        assertEquals(parser.getChannel("#DMDirc_testing"), cci.getChannel());
87
-        assertEquals("+", cci.getAllModesPrefix());
88
-    }    
89
-    
90
-    @Test
91
-    public void testOverrideNick() throws CallbackNotFoundException {
92
-        final TestParser parser = new TestParser();
93
-        final ErrorInfoListener info = mock(ErrorInfoListener.class);
94
-
95
-        parser.injectConnectionStrings();
96
-        parser.injectLine(":nick JOIN #DMDirc_testing");
97
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser @+nick2 nick3");
98
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list");
99
-        parser.injectLine(":luser!lu@ser.com NICK nick3");
100
-
101
-        verify(info).onErrorInfo(same(parser), anyObject(), anyObject());
102
-    }
103
-    
104
-    @Test
105
-    public void testUnknownNick() {
106
-        final TestParser parser = new TestParser();
107
-        final NickChangeListener tinc = mock(NickChangeListener.class);
108
-
109
-        parser.injectConnectionStrings();
110
-        parser.injectLine(":random!lu@ser NICK rand");
111
-
112
-        verify(tinc, never()).onNickChanged(anyObject(), anyObject(), anyObject(), anyString());
113
-    }
114
-
115
-}

+ 0
- 90
irc/test/com/dmdirc/parser/irc/processors/ProcessPartTest.java Просмотреть файл

@@ -1,90 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
-import com.dmdirc.parser.interfaces.callbacks.ChannelPartListener;
29
-import java.util.Date;
30
-
31
-import org.junit.Ignore;
32
-import org.junit.Test;
33
-import static org.junit.Assert.*;
34
-import static org.mockito.Mockito.*;
35
-
36
-@Ignore
37
-public class ProcessPartTest {
38
-    
39
-    @Test
40
-    public void testNormalPart() throws CallbackNotFoundException {
41
-        final TestParser parser = new TestParser();
42
-
43
-        parser.injectConnectionStrings();
44
-
45
-        parser.injectLine(":nick JOIN #DMDirc_testing");
46
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser");
47
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list.");
48
-        
49
-        final ChannelPartListener test = mock(ChannelPartListener.class);
50
-        
51
-        assertEquals(2, parser.getChannel("#DMDirc_testing").getChannelClients().size());
52
-
53
-        final ChannelClientInfo cci = parser.getChannel("#DMDirc_testing")
54
-                .getChannelClient("luser");
55
-
56
-        parser.injectLine(":luser!foo@barsville PART #DMDirc_testing :Bye bye, cruel world");
57
-        
58
-        assertEquals(1, parser.getChannel("#DMDirc_testing").getChannelClients().size());
59
-
60
-        verify(test).onChannelPart(same(parser), (Date) anyObject(),
61
-                same(parser.getChannel("#DMDirc_testing")),
62
-                same(cci), eq("Bye bye, cruel world"));
63
-    }
64
-    
65
-    @Test
66
-    public void testEmptyPart() throws CallbackNotFoundException {
67
-        final TestParser parser = new TestParser();
68
-
69
-        parser.injectConnectionStrings();
70
-
71
-        parser.injectLine(":nick JOIN #DMDirc_testing");
72
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser");
73
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list.");
74
-        
75
-        final ChannelPartListener test = mock(ChannelPartListener.class);
76
-        
77
-        assertEquals(2, parser.getChannel("#DMDirc_testing").getChannelClients().size());
78
-
79
-        final ChannelClientInfo cci = parser.getChannel("#DMDirc_testing")
80
-                .getChannelClient("luser");
81
-        
82
-        parser.injectLine(":luser!foo@barsville PART #DMDirc_testing");
83
-        
84
-        assertEquals(1, parser.getChannel("#DMDirc_testing").getChannelClients().size());
85
-
86
-        verify(test).onChannelPart(same(parser), (Date) anyObject(),
87
-                same(parser.getChannel("#DMDirc_testing")), same(cci), eq(""));
88
-    }    
89
-
90
-}

+ 0
- 122
irc/test/com/dmdirc/parser/irc/processors/ProcessQuitTest.java Просмотреть файл

@@ -1,122 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.interfaces.callbacks.ChannelQuitListener;
27
-import com.dmdirc.parser.interfaces.callbacks.QuitListener;
28
-import com.dmdirc.parser.interfaces.ChannelClientInfo;
29
-import com.dmdirc.parser.interfaces.ClientInfo;
30
-import com.dmdirc.parser.common.CallbackNotFoundException;
31
-import java.util.Date;
32
-
33
-import org.junit.Ignore;
34
-import org.junit.Test;
35
-import static org.junit.Assert.*;
36
-import static org.mockito.Mockito.*;
37
-
38
-@Ignore
39
-public class ProcessQuitTest {
40
-    
41
-    @Test
42
-    public void testChannelQuit() throws CallbackNotFoundException {
43
-        final TestParser parser = new TestParser();
44
-
45
-        parser.injectConnectionStrings();
46
-
47
-        parser.injectLine(":nick JOIN #DMDirc_testing");
48
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser");
49
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list.");
50
-        parser.injectLine(":nick JOIN #DMDirc_testing2");
51
-        parser.injectLine(":server 353 nick = #DMDirc_testing2 :@nick +luser2");
52
-        parser.injectLine(":server 366 nick #DMDirc_testing2 :End of /NAMES list.");        
53
-        
54
-        final ChannelQuitListener test = mock(ChannelQuitListener.class);
55
-        
56
-        assertEquals(2, parser.getChannel("#DMDirc_testing").getChannelClients().size());
57
-
58
-        final ChannelClientInfo cci = parser.getChannel("#DMDirc_testing")
59
-                .getChannelClient("luser");
60
-        
61
-        parser.injectLine(":luser!foo@barsville QUIT :Bye bye, cruel world");
62
-        
63
-        assertEquals(1, parser.getChannel("#DMDirc_testing").getChannelClients().size());
64
-        assertEquals(2, parser.getChannel("#DMDirc_testing2").getChannelClients().size());
65
-
66
-        verify(test).onChannelQuit(same(parser), (Date) anyObject(),
67
-                same(parser.getChannel("#DMDirc_testing")), same(cci),
68
-                eq("Bye bye, cruel world"));
69
-    }
70
-    
71
-    @Test
72
-    public void testGlobalQuit() throws CallbackNotFoundException {
73
-        final TestParser parser = new TestParser();
74
-
75
-        parser.injectConnectionStrings();
76
-
77
-        parser.injectLine(":nick JOIN #DMDirc_testing");
78
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser");
79
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list.");
80
-        parser.injectLine(":nick JOIN #DMDirc_testing2");
81
-        parser.injectLine(":server 353 nick = #DMDirc_testing2 :@nick +luser2");
82
-        parser.injectLine(":server 366 nick #DMDirc_testing2 :End of /NAMES list.");
83
-        
84
-        final QuitListener test = mock(QuitListener.class);
85
-        
86
-        assertEquals(2, parser.getChannel("#DMDirc_testing").getChannelClients().size());
87
-
88
-        final ClientInfo client = parser.getClient("luser");
89
-        
90
-        parser.injectLine(":luser!foo@barsville QUIT :Bye bye, cruel world");
91
-        
92
-        assertEquals(1, parser.getChannel("#DMDirc_testing").getChannelClients().size());
93
-        assertEquals(2, parser.getChannel("#DMDirc_testing2").getChannelClients().size());
94
-
95
-        verify(test).onQuit(same(parser), (Date) anyObject(),
96
-                same(client), eq("Bye bye, cruel world"));
97
-    }
98
-    
99
-    @Test
100
-    public void testEmptyQuit() throws CallbackNotFoundException {
101
-        final TestParser parser = new TestParser();
102
-
103
-        parser.injectConnectionStrings();
104
-
105
-        parser.injectLine(":nick JOIN #DMDirc_testing");
106
-        parser.injectLine(":server 353 nick = #DMDirc_testing :@nick +luser");
107
-        parser.injectLine(":server 366 nick #DMDirc_testing :End of /NAMES list.");
108
-        
109
-        final QuitListener test = mock(QuitListener.class);
110
-        
111
-        assertEquals(2, parser.getChannel("#DMDirc_testing").getChannelClients().size());
112
-
113
-        final ClientInfo client = parser.getClient("luser");
114
-        
115
-        parser.injectLine(":luser!foo@barsville QUIT");
116
-        
117
-        assertEquals(1, parser.getChannel("#DMDirc_testing").getChannelClients().size());
118
-        
119
-        verify(test).onQuit(same(parser), (Date) anyObject(), same(client), eq(""));
120
-    }    
121
-
122
-}

+ 0
- 79
irc/test/com/dmdirc/parser/irc/processors/ProcessTopicTest.java Просмотреть файл

@@ -1,79 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.harness.parser.TestParser;
26
-import com.dmdirc.parser.common.CallbackNotFoundException;
27
-import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
28
-import java.util.Date;
29
-
30
-import org.junit.Ignore;
31
-import org.junit.Test;
32
-import static org.junit.Assert.*;
33
-import static org.mockito.Mockito.*;
34
-
35
-@Ignore
36
-public class ProcessTopicTest {
37
-    
38
-    @Test
39
-    public void testBasicTopic() throws CallbackNotFoundException {
40
-        final TestParser parser = new TestParser();
41
-        final ChannelTopicListener test = mock(ChannelTopicListener.class);
42
-        parser.injectConnectionStrings();
43
-        
44
-        parser.injectLine(":nick JOIN #DMDirc_testing");
45
-        parser.injectLine(":server 332 nick #DMDirc_testing :This be a topic");
46
-        parser.injectLine(":server 333 nick #DMDirc_testing Q 1207350306");
47
-
48
-        verify(test).onChannelTopic(same(parser), (Date) anyObject(),
49
-                same(parser.getChannel("#DMDirc_testing")), eq(true));
50
-
51
-        assertEquals("#DMDirc_testing", parser.getChannel("#DMDirc_testing").getName());
52
-        assertEquals("This be a topic", parser.getChannel("#DMDirc_testing").getTopic());
53
-        assertEquals("Q", parser.getChannel("#DMDirc_testing").getTopicSetter());
54
-        assertEquals(1207350306l, parser.getChannel("#DMDirc_testing").getTopicTime());
55
-    }
56
-    
57
-    @Test
58
-    public void testTopicChange() throws CallbackNotFoundException {
59
-        final TestParser parser = new TestParser();
60
-        final ChannelTopicListener test = mock(ChannelTopicListener.class);
61
-        parser.injectConnectionStrings();
62
-        
63
-        parser.injectLine(":nick JOIN #DMDirc_testing");
64
-        parser.injectLine(":server 332 nick #DMDirc_testing :This be a topic");
65
-        parser.injectLine(":server 333 nick #DMDirc_testing Q 1207350306");
66
-
67
-        
68
-        parser.injectLine(":foobar TOPIC #DMDirc_testing :New topic here");
69
-
70
-        verify(test).onChannelTopic(same(parser), (Date) anyObject(),
71
-                same(parser.getChannel("#DMDirc_testing")), eq(false));
72
-        
73
-        assertEquals("#DMDirc_testing", parser.getChannel("#DMDirc_testing").getName());
74
-        assertEquals("New topic here", parser.getChannel("#DMDirc_testing").getTopic());
75
-        assertEquals("foobar", parser.getChannel("#DMDirc_testing").getTopicSetter());
76
-        assertTrue(1207350306l < parser.getChannel("#DMDirc_testing").getTopicTime());
77
-    }    
78
-
79
-}

+ 0
- 59
irc/test/com/dmdirc/parser/irc/processors/ProcessWhoTest.java Просмотреть файл

@@ -1,59 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2015 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc.processors;
24
-
25
-import com.dmdirc.parser.common.AwayState;
26
-import com.dmdirc.harness.parser.TestParser;
27
-import com.dmdirc.parser.common.CallbackNotFoundException;
28
-import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
29
-import com.dmdirc.parser.irc.IRCParser;
30
-
31
-import java.util.Date;
32
-
33
-import org.junit.Ignore;
34
-import org.junit.Test;
35
-import static org.mockito.Mockito.*;
36
-
37
-@Ignore
38
-public class ProcessWhoTest {
39
-
40
-    @Test
41
-    public void testSelfAway() throws CallbackNotFoundException {
42
-        final TestParser parser = new TestParser();
43
-        final AwayStateListener test = mock(AwayStateListener.class);
44
-        parser.injectConnectionStrings();
45
-
46
-        parser.injectLine(":nick JOIN #DMDirc_testing");
47
-
48
-        parser.injectLine(":server 352 nick #DMDirc_testing nick2 host2 server nick2 G@ :0 rn");
49
-
50
-        verify(test, never()).onAwayState((IRCParser) anyObject(),
51
-                (Date) anyObject(), (AwayState) anyObject(), (AwayState) anyObject() , anyString());
52
-
53
-        parser.injectLine(":server 352 nick #DMDirc_testing nick host server nick G@ :0 rn");
54
-
55
-        verify(test).onAwayState(same(parser), (Date) anyObject(),
56
-                same(AwayState.UNKNOWN), same(AwayState.AWAY), eq(""));
57
-    }
58
-
59
-}

Загрузка…
Отмена
Сохранить