????????????Android app?????????д?ЩС?????????????????????????????????????????????????????棨Activity????????£??????????????????app???????log????????????????????????????Android Studio?????????????????????????鷳?????д??????????Junit????????????С????
???????????
????· ????
????· ??дJ(rèn)ava????????
????· ??дAndroid????????
????· ???????????
????????
??????Android Studio?н??е??????????????????????????????Android Studio????????????????????????????java????????????????Android SDK??Android?????????????????????
?????????????gradle?м???Junit??????????????????????????????????????testCompile????
????dependencies {
????testCompile 'junit:junit:4.12'
????}
?????????????app/src?????main?????????????androidTest??test??????????????????????java/com/xxx/xxx??????????????μ?????????????ú?????????Android Studio??Project??????????????

??????дJ(rèn)ava????????
?????????д??????????????android sdk??android.***?μ???????????????test??????????????м??ExampleUnitTest???????в????????RxJava??Observable???????????????
???????????????????public void??????????????@Test???????Junit?????÷?
package com.jason.rxjavademo;
import org.junit.Test;
import rx.Observer;
import rx.subjects.PublishSubject;
public class ExampleUnitTest {
@Test
public void testPublishSubject() {
PublishSubject<String> stringPublishSubject = PublishSubject.create();
stringPublishSubject.subscribe(new Observer<String>() {
@Override
public void onCompleted() {
System.out.println("Observable completed");
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(String s) {
System.out.println("Observer consumed " + s);
}
});
stringPublishSubject.onNext("hello world");
stringPublishSubject.onCompleted();
}
}
??????????Android Studio????Structure????壬???????????????????testPublishSubject


????