Skip to content

Commit a04add9

Browse files
author
YangSen-qn
committed
change log test case
1 parent b30ebb2 commit a04add9

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

library/src/androidTest/java/com/qiniu/android/LogUtilsTest.java

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,42 @@
66

77
public class LogUtilsTest extends BaseTest {
88

9-
public void testLog(){
9+
public void testLog() {
1010

1111
LogUtil.enableLog(true);
1212
LogUtil.setLogLevel(Log.VERBOSE);
1313

1414
Throwable throwable = new Throwable();
1515

16-
int ret = LogUtil.v("log");
17-
assertTrue("log ret:" + ret, ret > 0);
18-
assertTrue(LogUtil.v("v","log") > 0);
19-
assertTrue(LogUtil.v("v","log", null) > 0);
20-
assertTrue(LogUtil.v("v","log", throwable) > 0);
16+
assertTrue(validLogCode(LogUtil.v("log")));
17+
assertTrue(validLogCode(LogUtil.v("v", "log")));
18+
assertTrue(validLogCode(LogUtil.v("v", "log", null)));
19+
assertTrue(validLogCode(LogUtil.v("v", "log", throwable)));
2120

22-
assertTrue(LogUtil.d("log") > 0);
23-
assertTrue(LogUtil.d("v","log") > 0);
24-
assertTrue(LogUtil.d("v","log", null) > 0);
25-
assertTrue(LogUtil.d("v","log", throwable) > 0);
21+
assertTrue(validLogCode(LogUtil.d("log")));
22+
assertTrue(validLogCode(LogUtil.d("v", "log")));
23+
assertTrue(validLogCode(LogUtil.d("v", "log", null)));
24+
assertTrue(validLogCode(LogUtil.d("v", "log", throwable)));
2625

27-
assertTrue(LogUtil.i("log") > 0);
28-
assertTrue(LogUtil.i("v","log") > 0);
29-
assertTrue(LogUtil.i("v","log", null) > 0);
30-
assertTrue(LogUtil.i("v","log", throwable) > 0);
26+
assertTrue(validLogCode(LogUtil.i("log")));
27+
assertTrue(validLogCode(LogUtil.i("v", "log")));
28+
assertTrue(validLogCode(LogUtil.i("v", "log", null)));
29+
assertTrue(validLogCode(LogUtil.i("v", "log", throwable)));
3130

32-
assertTrue(LogUtil.w("log") > 0);
33-
assertTrue(LogUtil.w("v","log") > 0);
34-
assertTrue(LogUtil.w("v","log", null) > 0);
35-
assertTrue(LogUtil.w("v","log", throwable) > 0);
31+
assertTrue(validLogCode(LogUtil.w("log")));
32+
assertTrue(validLogCode(LogUtil.w("v", "log")));
33+
assertTrue(validLogCode(LogUtil.w("v", "log", null)));
34+
assertTrue(validLogCode(LogUtil.w("v", "log", throwable)));
3635

37-
assertTrue(LogUtil.e("log") > 0);
38-
assertTrue(LogUtil.e("v","log") > 0);
39-
assertTrue(LogUtil.e("v","log", null) > 0);
40-
assertTrue(LogUtil.e("v","log", throwable) > 0);
36+
assertTrue(validLogCode(LogUtil.e("log")));
37+
assertTrue(validLogCode(LogUtil.e("v", "log")));
38+
assertTrue(validLogCode(LogUtil.e("v", "log", null)));
39+
assertTrue(validLogCode(LogUtil.e("v", "log", throwable)));
4140

4241
LogUtil.enableLog(false);
4342
}
43+
44+
private boolean validLogCode(int code) {
45+
return code > 0 || code == -10000 || code == -10001;
46+
}
4447
}

0 commit comments

Comments
 (0)