@@ -62,51 +62,51 @@ public class StringObservableTest {
62
62
63
63
@ Test
64
64
public void testMultibyteSpanningTwoBuffers () {
65
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 }, new byte [] { (byte ) 0xa1 });
66
- String out = StringObservable .decode (src , "UTF-8" ).toBlockingObservable ().single ();
65
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 }, new byte [] { (byte ) 0xa1 });
66
+ String out = StringObservable .decode (src , "UTF-8" ).toBlocking ().single ();
67
67
68
68
assertEquals ("\u00A1 " , out );
69
69
}
70
70
71
71
@ Test
72
72
public void testMalformedAtTheEndReplace () {
73
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 });
74
- String out = decode (src , "UTF-8" ).toBlockingObservable ().single ();
73
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 });
74
+ String out = decode (src , "UTF-8" ).toBlocking ().single ();
75
75
76
76
// REPLACEMENT CHARACTER
77
77
assertEquals ("\uFFFD " , out );
78
78
}
79
79
80
80
@ Test
81
81
public void testMalformedInTheMiddleReplace () {
82
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 , 65 });
83
- String out = decode (src , "UTF-8" ).toBlockingObservable ().single ();
82
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 , 65 });
83
+ String out = decode (src , "UTF-8" ).toBlocking ().single ();
84
84
85
85
// REPLACEMENT CHARACTER
86
86
assertEquals ("\uFFFD A" , out );
87
87
}
88
88
89
89
@ Test (expected = RuntimeException .class )
90
90
public void testMalformedAtTheEndReport () {
91
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 });
91
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 });
92
92
CharsetDecoder charsetDecoder = Charset .forName ("UTF-8" ).newDecoder ();
93
- decode (src , charsetDecoder ).toBlockingObservable ().single ();
93
+ decode (src , charsetDecoder ).toBlocking ().single ();
94
94
}
95
95
96
96
@ Test (expected = RuntimeException .class )
97
97
public void testMalformedInTheMiddleReport () {
98
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 , 65 });
98
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 , 65 });
99
99
CharsetDecoder charsetDecoder = Charset .forName ("UTF-8" ).newDecoder ();
100
- decode (src , charsetDecoder ).toBlockingObservable ().single ();
100
+ decode (src , charsetDecoder ).toBlocking ().single ();
101
101
}
102
102
103
103
@ Test
104
104
public void testPropogateError () {
105
- Observable <byte []> src = Observable .from (new byte [] { 65 });
105
+ Observable <byte []> src = Observable .just (new byte [] { 65 });
106
106
Observable <byte []> err = Observable .error (new IOException ());
107
107
CharsetDecoder charsetDecoder = Charset .forName ("UTF-8" ).newDecoder ();
108
108
try {
109
- decode (Observable .concat (src , err ), charsetDecoder ).toList ().toBlockingObservable ().single ();
109
+ decode (Observable .concat (src , err ), charsetDecoder ).toList ().toBlocking ().single ();
110
110
fail ();
111
111
} catch (RuntimeException e ) {
112
112
assertEquals (IOException .class , e .getCause ().getClass ());
@@ -115,11 +115,11 @@ public void testPropogateError() {
115
115
116
116
@ Test
117
117
public void testPropogateErrorInTheMiddleOfMultibyte () {
118
- Observable <byte []> src = Observable .from (new byte [] { (byte ) 0xc2 });
118
+ Observable <byte []> src = Observable .just (new byte [] { (byte ) 0xc2 });
119
119
Observable <byte []> err = Observable .error (new IOException ());
120
120
CharsetDecoder charsetDecoder = Charset .forName ("UTF-8" ).newDecoder ();
121
121
try {
122
- decode (Observable .concat (src , err ), charsetDecoder ).toList ().toBlockingObservable ().single ();
122
+ decode (Observable .concat (src , err ), charsetDecoder ).toList ().toBlocking ().single ();
123
123
fail ();
124
124
} catch (RuntimeException e ) {
125
125
assertEquals (MalformedInputException .class , e .getCause ().getClass ());
@@ -130,7 +130,7 @@ public void testPropogateErrorInTheMiddleOfMultibyte() {
130
130
public void testEncode () {
131
131
assertArrayEquals (
132
132
new byte [] { (byte ) 0xc2 , (byte ) 0xa1 }, encode (Observable .just ("\u00A1 " ), "UTF-8" )
133
- .toBlockingObservable ().single ());
133
+ .toBlocking ().single ());
134
134
}
135
135
136
136
@ Test
@@ -144,11 +144,11 @@ public void testSplitOnOh() {
144
144
}
145
145
146
146
public void testSplit (String str , String regex , int limit , String ... parts ) {
147
- testSplit (str , regex , 0 , Observable .from (str ), parts );
147
+ testSplit (str , regex , 0 , Observable .just (str ), parts );
148
148
for (int i = 0 ; i < str .length (); i ++) {
149
149
String a = str .substring (0 , i );
150
150
String b = str .substring (i , str .length ());
151
- testSplit (a + "|" + b , regex , limit , Observable .from (a , b ), parts );
151
+ testSplit (a + "|" + b , regex , limit , Observable .just (a , b ), parts );
152
152
}
153
153
}
154
154
@@ -176,7 +176,7 @@ public void testJoinMixed() {
176
176
177
177
@ Test
178
178
public void testJoinWithEmptyString () {
179
- Observable <String > source = Observable .from ("" , "b" , "c" );
179
+ Observable <String > source = Observable .just ("" , "b" , "c" );
180
180
181
181
Observable <String > result = join (source , ", " );
182
182
@@ -192,7 +192,7 @@ public void testJoinWithEmptyString() {
192
192
193
193
@ Test
194
194
public void testJoinWithNull () {
195
- Observable <String > source = Observable .from ("a" , null , "c" );
195
+ Observable <String > source = Observable .just ("a" , null , "c" );
196
196
197
197
Observable <String > result = join (source , ", " );
198
198
@@ -208,7 +208,7 @@ public void testJoinWithNull() {
208
208
209
209
@ Test
210
210
public void testJoinSingle () {
211
- Observable <String > source = Observable .from ("a" );
211
+ Observable <String > source = Observable .just ("a" );
212
212
213
213
Observable <String > result = join (source , ", " );
214
214
@@ -258,7 +258,7 @@ public void testJoinThrows() {
258
258
@ Test
259
259
public void testFromInputStream () {
260
260
final byte [] inBytes = "test" .getBytes ();
261
- final byte [] outBytes = from (new ByteArrayInputStream (inBytes )).toBlockingObservable ().single ();
261
+ final byte [] outBytes = from (new ByteArrayInputStream (inBytes )).toBlocking ().single ();
262
262
assertNotSame (inBytes , outBytes );
263
263
assertArrayEquals (inBytes , outBytes );
264
264
}
@@ -275,14 +275,14 @@ public synchronized int read(byte[] b, int off, int len) {
275
275
return super .read (b , off , len );
276
276
}
277
277
};
278
- StringObservable .from (is ).first ().toBlockingObservable ().single ();
278
+ StringObservable .from (is ).first ().toBlocking ().single ();
279
279
assertEquals (1 , numReads .get ());
280
280
}
281
281
282
282
@ Test
283
283
public void testFromReader () {
284
284
final String inStr = "test" ;
285
- final String outStr = from (new StringReader (inStr )).toBlockingObservable ().single ();
285
+ final String outStr = from (new StringReader (inStr )).toBlocking ().single ();
286
286
assertNotSame (inStr , outStr );
287
287
assertEquals (inStr , outStr );
288
288
}
@@ -292,7 +292,7 @@ public void testByLine() {
292
292
String newLine = System .getProperty ("line.separator" );
293
293
294
294
List <Line > lines = byLine (Observable .from (Arrays .asList ("qwer" , newLine + "asdf" + newLine , "zx" , "cv" )))
295
- .toList ().toBlockingObservable ().single ();
295
+ .toList ().toBlocking ().single ();
296
296
297
297
assertEquals (Arrays .asList (new Line (0 , "qwer" ), new Line (1 , "asdf" ), new Line (2 , "zxcv" )), lines );
298
298
}
0 commit comments