forked from baiiu/AndroidModule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonUtilTest.java
More file actions
57 lines (47 loc) · 1.64 KB
/
Copy pathCommonUtilTest.java
File metadata and controls
57 lines (47 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.example.testing.testingexample;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
/**
* author: baiiu
* date: on 16/4/29 17:51
* description:
* CommonUtil中一部分没有依赖framework,在此处测.
*/
public class CommonUtilTest {
private List<String> emptyList;
private List<String> notEmptyList;
private List<String> notEmptyListAnother;
@Before public void setUp() throws Exception {
emptyList = Collections.emptyList();
notEmptyList = Arrays.asList("哈哈", "哈哈哈");
notEmptyListAnother = Arrays.asList("哈哈哈", "哈哈哈", "哈哈");
}
@Test public void testIsListEmpty() throws Exception {
assertTrue(CommonUtil.isEmpty(emptyList));
assertFalse(CommonUtil.isEmpty(notEmptyList));
}
@Test public void testIsAllListEmpty() throws Exception {
assertTrue(CommonUtil.isAllEmpty(emptyList, Collections.emptyList(), new ArrayList()));
assertFalse(CommonUtil.isAllEmpty(emptyList, notEmptyList));
}
@Test public void testIsOneListEmpty() throws Exception {
assertTrue(CommonUtil.isOneEmpty(emptyList, Collections.emptyList()));
assertTrue(CommonUtil.isOneEmpty(emptyList, notEmptyList));
assertFalse(CommonUtil.isOneEmpty(notEmptyList, notEmptyListAnother));
}
/*
TextUtils is not mocked
*/
public void testIsStringEmpty() throws Exception {
}
public void testIsAllStringEmpty() throws Exception {
}
public void testIsOneStringEmpty() throws Exception {
}
}