Skip to content

Commit ffd8381

Browse files
committed
add testcase for getServerDate
1 parent 157d97e commit ffd8381

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

android-sdk/storage-sample-app/src/main/java/cn/leancloud/sample/testcase/OtherDemoActivity.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
package cn.leancloud.sample.testcase;
22

33
import cn.leancloud.LCException;
4+
import cn.leancloud.LCQuery;
45
import cn.leancloud.LeanCloud;
56
import cn.leancloud.sample.DemoBaseActivity;
67
import cn.leancloud.sample.Student;
78
import cn.leancloud.core.AppConfiguration;
9+
import cn.leancloud.types.LCDate;
10+
import io.reactivex.Observer;
11+
import io.reactivex.disposables.Disposable;
812

913
/**
1014
* Created by fengjunwen on 2018/5/10.
1115
*/
1216

1317
public class OtherDemoActivity extends DemoBaseActivity {
14-
// public void testGetSereverDate() throws LCException {
15-
// Date date = AVOSCloud.getServerDate();
16-
// log("服务器时间:" + date);
17-
// }
18+
public void testGetSereverDate() throws LCException {
19+
LeanCloud.getServerDateInBackground().subscribe(new Observer<LCDate>() {
20+
@Override
21+
public void onSubscribe(Disposable d) {
22+
23+
}
24+
25+
@Override
26+
public void onNext(LCDate lcDate) {
27+
log("服务器时间:" + lcDate);
28+
}
29+
30+
@Override
31+
public void onError(Throwable e) {
32+
33+
}
34+
35+
@Override
36+
public void onComplete() {
37+
38+
}
39+
});
40+
}
1841

1942
public void testConfigNetworkTimeout() throws LCException {
2043
// 得放到 Application 里

0 commit comments

Comments
 (0)