11package rx .operators ;
22
3+ import static org .mockito .Matchers .*;
4+ import static org .mockito .Mockito .*;
5+ import static org .mockito .MockitoAnnotations .*;
6+ import static rx .operators .OperationDistinct .*;
7+
8+ import java .util .Comparator ;
9+
310import org .junit .Before ;
411import org .junit .Test ;
512import org .mockito .InOrder ;
613import org .mockito .Mock ;
14+
715import rx .Observable ;
816import rx .Observer ;
917import rx .util .functions .Func1 ;
1018
11- import java .util .Comparator ;
12-
13- import static org .mockito .Matchers .any ;
14- import static org .mockito .Matchers .anyString ;
15- import static org .mockito .Mockito .*;
16- import static org .mockito .Mockito .never ;
17- import static org .mockito .MockitoAnnotations .initMocks ;
18- import static rx .Observable .*;
19- import static rx .operators .OperationDistinct .distinct ;
20-
2119public class OperationDistinctTest {
2220
2321 @ Mock
@@ -50,8 +48,8 @@ public void before() {
5048
5149 @ Test
5250 public void testDistinctOfNone () {
53- Observable <String > src = empty ();
54- create (distinct (src )).subscribe (w );
51+ Observable <String > src = Observable . empty ();
52+ Observable . create (distinct (src )).subscribe (w );
5553
5654 verify (w , never ()).onNext (anyString ());
5755 verify (w , never ()).onError (any (Throwable .class ));
@@ -60,8 +58,8 @@ public void testDistinctOfNone() {
6058
6159 @ Test
6260 public void testDistinctOfNoneWithKeySelector () {
63- Observable <String > src = empty ();
64- create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
61+ Observable <String > src = Observable . empty ();
62+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
6563
6664 verify (w , never ()).onNext (anyString ());
6765 verify (w , never ()).onError (any (Throwable .class ));
@@ -70,8 +68,8 @@ public void testDistinctOfNoneWithKeySelector() {
7068
7169 @ Test
7270 public void testDistinctOfNormalSource () {
73- Observable <String > src = from ("a" , "b" , "c" , "c" , "c" , "b" , "b" , "a" , "e" );
74- create (distinct (src )).subscribe (w );
71+ Observable <String > src = Observable . from ("a" , "b" , "c" , "c" , "c" , "b" , "b" , "a" , "e" );
72+ Observable . create (distinct (src )).subscribe (w );
7573
7674 InOrder inOrder = inOrder (w );
7775 inOrder .verify (w , times (1 )).onNext ("a" );
@@ -85,8 +83,8 @@ public void testDistinctOfNormalSource() {
8583
8684 @ Test
8785 public void testDistinctOfNormalSourceWithKeySelector () {
88- Observable <String > src = from ("a" , "B" , "c" , "C" , "c" , "B" , "b" , "a" , "E" );
89- create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
86+ Observable <String > src = Observable . from ("a" , "B" , "c" , "C" , "c" , "B" , "b" , "a" , "E" );
87+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
9088
9189 InOrder inOrder = inOrder (w );
9290 inOrder .verify (w , times (1 )).onNext ("a" );
@@ -100,8 +98,8 @@ public void testDistinctOfNormalSourceWithKeySelector() {
10098
10199 @ Test
102100 public void testDistinctOfNormalSourceWithComparator () {
103- Observable <String > src = from ("1" , "12" , "123" , "aaa" , "321" , "12" , "21" , "1" , "12345" );
104- create (distinct (src , COMPARE_LENGTH )).subscribe (w );
101+ Observable <String > src = Observable . from ("1" , "12" , "123" , "aaa" , "321" , "12" , "21" , "1" , "12345" );
102+ Observable . create (distinct (src , COMPARE_LENGTH )).subscribe (w );
105103
106104 InOrder inOrder = inOrder (w );
107105 inOrder .verify (w , times (1 )).onNext ("1" );
@@ -115,8 +113,8 @@ public void testDistinctOfNormalSourceWithComparator() {
115113
116114 @ Test
117115 public void testDistinctOfNormalSourceWithKeySelectorAndComparator () {
118- Observable <String > src = from ("a" , "x" , "ab" , "abc" , "cba" , "de" , "x" , "a" , "abcd" );
119- create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w );
116+ Observable <String > src = Observable . from ("a" , "x" , "ab" , "abc" , "cba" , "de" , "x" , "a" , "abcd" );
117+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w );
120118
121119 InOrder inOrder = inOrder (w );
122120 inOrder .verify (w , times (1 )).onNext ("a" );
@@ -130,13 +128,13 @@ public void testDistinctOfNormalSourceWithKeySelectorAndComparator() {
130128
131129 @ Test
132130 public void testDistinctOfNormalSourceWithKeySelectorAndComparatorAndTwoSubscriptions () {
133- Observable <String > src = from ("a" , "x" , "ab" , "abc" , "cba" , "de" , "x" , "a" , "abcd" );
134- create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w );
131+ Observable <String > src = Observable . from ("a" , "x" , "ab" , "abc" , "cba" , "de" , "x" , "a" , "abcd" );
132+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w );
135133
136134 InOrder inOrder = inOrder (w );
137135 inOrder .verify (w , times (1 )).onNext ("a" );
138136 inOrder .verify (w , times (1 )).onNext ("x" );
139- create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w2 );
137+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION , COMPARE_LENGTH )).subscribe (w2 );
140138 inOrder .verify (w , times (1 )).onNext ("abc" );
141139 inOrder .verify (w , times (1 )).onNext ("abcd" );
142140 inOrder .verify (w , times (1 )).onCompleted ();
@@ -155,8 +153,8 @@ public void testDistinctOfNormalSourceWithKeySelectorAndComparatorAndTwoSubscrip
155153
156154 @ Test
157155 public void testDistinctOfSourceWithNulls () {
158- Observable <String > src = from (null , "a" , "a" , null , null , "b" , null );
159- create (distinct (src )).subscribe (w );
156+ Observable <String > src = Observable . from (null , "a" , "a" , null , null , "b" , null );
157+ Observable . create (distinct (src )).subscribe (w );
160158
161159 InOrder inOrder = inOrder (w );
162160 inOrder .verify (w , times (1 )).onNext (null );
@@ -169,8 +167,8 @@ public void testDistinctOfSourceWithNulls() {
169167
170168 @ Test
171169 public void testDistinctOfSourceWithExceptionsFromKeySelector () {
172- Observable <String > src = from ("a" , "b" , null , "c" );
173- create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
170+ Observable <String > src = Observable . from ("a" , "b" , null , "c" );
171+ Observable . create (distinct (src , TO_UPPER_WITH_EXCEPTION )).subscribe (w );
174172
175173 InOrder inOrder = inOrder (w );
176174 inOrder .verify (w , times (1 )).onNext ("a" );
0 commit comments