|
@@ -71,8 +71,8 @@ public class IRCReaderTest {
|
71
|
71
|
final InputStream stream = new ByteArrayInputStream("te t :foo\r\n".getBytes());
|
72
|
72
|
final Encoder encoder = mock(Encoder.class);
|
73
|
73
|
|
74
|
|
- when(encoder.encode((String) isNull(), (String) isNull(),
|
75
|
|
- (byte[]) anyObject(), anyInt(), eq(3)))
|
|
74
|
+ when(encoder.encode(isNull(), isNull(),
|
|
75
|
+ anyObject(), anyInt(), eq(3)))
|
76
|
76
|
.thenReturn("encoded");
|
77
|
77
|
|
78
|
78
|
final IRCReader reader = new IRCReader(stream, encoder);
|
|
@@ -88,9 +88,7 @@ public class IRCReaderTest {
|
88
|
88
|
final InputStream stream = new ByteArrayInputStream("foo bar baz :qux baz\r\n".getBytes());
|
89
|
89
|
final Encoder encoder = mock(Encoder.class);
|
90
|
90
|
|
91
|
|
- when(encoder.encode((String) isNull(), (String) isNull(),
|
92
|
|
- (byte[]) anyObject(), eq(15), eq(8)))
|
93
|
|
- .thenReturn("qux baz");
|
|
91
|
+ when(encoder.encode(isNull(), isNull(), any(), eq(15), eq(8))).thenReturn("qux baz");
|
94
|
92
|
|
95
|
93
|
final IRCReader reader = new IRCReader(stream, encoder);
|
96
|
94
|
final ReadLine line = reader.readLine();
|
|
@@ -106,8 +104,7 @@ public class IRCReaderTest {
|
106
|
104
|
|
107
|
105
|
new IRCReader(stream, encoder).readLine();
|
108
|
106
|
|
109
|
|
- verify(encoder).encode(eq("src"), anyString(),
|
110
|
|
- (byte[]) anyObject(), anyInt(), anyInt());
|
|
107
|
+ verify(encoder).encode(eq("src"), isNull(), any(), anyInt(), anyInt());
|
111
|
108
|
}
|
112
|
109
|
|
113
|
110
|
/** Verifies that no source is passed if the source is empty. */
|
|
@@ -118,8 +115,7 @@ public class IRCReaderTest {
|
118
|
115
|
|
119
|
116
|
new IRCReader(stream, encoder).readLine();
|
120
|
117
|
|
121
|
|
- verify(encoder).encode((String) isNull(), anyString(),
|
122
|
|
- (byte[]) anyObject(), anyInt(), anyInt());
|
|
118
|
+ verify(encoder).encode(isNull(), isNull(), any(), anyInt(), anyInt());
|
123
|
119
|
}
|
124
|
120
|
|
125
|
121
|
/** Verifies that a destination is extracted properly. */
|
|
@@ -130,8 +126,7 @@ public class IRCReaderTest {
|
130
|
126
|
|
131
|
127
|
new IRCReader(stream, encoder).readLine();
|
132
|
128
|
|
133
|
|
- verify(encoder).encode(anyString(), eq("y"), (byte[]) anyObject(),
|
134
|
|
- anyInt(), anyInt());
|
|
129
|
+ verify(encoder).encode(anyString(), eq("y"), any(), anyInt(), anyInt());
|
135
|
130
|
}
|
136
|
131
|
|
137
|
132
|
/** Verifies that no destination is extracted if there's no source. */
|
|
@@ -142,8 +137,7 @@ public class IRCReaderTest {
|
142
|
137
|
|
143
|
138
|
new IRCReader(stream, encoder).readLine();
|
144
|
139
|
|
145
|
|
- verify(encoder).encode(anyString(), (String) isNull(),
|
146
|
|
- (byte[]) anyObject(), anyInt(), anyInt());
|
|
140
|
+ verify(encoder).encode(isNull(), isNull(), any(), anyInt(), anyInt());
|
147
|
141
|
}
|
148
|
142
|
|
149
|
143
|
/** Verifies that no destination is extracted if there are too few args. */
|
|
@@ -154,8 +148,7 @@ public class IRCReaderTest {
|
154
|
148
|
|
155
|
149
|
new IRCReader(stream, encoder).readLine();
|
156
|
150
|
|
157
|
|
- verify(encoder).encode(anyString(), (String) isNull(),
|
158
|
|
- (byte[]) anyObject(), anyInt(), anyInt());
|
|
151
|
+ verify(encoder).encode(anyString(), isNull(), any(), anyInt(), anyInt());
|
159
|
152
|
}
|
160
|
153
|
|
161
|
154
|
/** Verifies that a numeric's destination is extracted properly. */
|
|
@@ -166,7 +159,7 @@ public class IRCReaderTest {
|
166
|
159
|
|
167
|
160
|
new IRCReader(stream, encoder).readLine();
|
168
|
161
|
|
169
|
|
- verify(encoder).encode(anyString(), eq("y"), (byte[]) anyObject(), anyInt(), anyInt());
|
|
162
|
+ verify(encoder).encode(anyString(), eq("y"), any(), anyInt(), anyInt());
|
170
|
163
|
}
|
171
|
164
|
|
172
|
165
|
/** Verifies that the close call is proxied to the stream. */
|
|
@@ -190,8 +183,7 @@ public class IRCReaderTest {
|
190
|
183
|
(int) '1', (int) ' ', 0xF6, (int) ' ', (int) 'y', (int) ' ', (int) 'z', (int) ' ',
|
191
|
184
|
(int) ':', (int) 'x', (int) '\r', (int) '\n');
|
192
|
185
|
|
193
|
|
- when(encoder.encode(anyString(), anyString(),
|
194
|
|
- (byte[]) any(), anyInt(), anyInt())).thenReturn("x");
|
|
186
|
+ when(encoder.encode(anyString(), anyString(), any(), anyInt(), anyInt())).thenReturn("x");
|
195
|
187
|
|
196
|
188
|
final ReadLine line = new IRCReader(stream, encoder, Charset.forName("UTF-8")).readLine();
|
197
|
189
|
|