Android Studio???????????
???????????? ???????[ 2016/5/23 14:26:20 ] ????????Android ???????
????????????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
????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11