blob: fe0f4c5161c124ae8e212dd9c1e4f91bdc6e45d8 (
plain)
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
|
package com.javispedro.rempe;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Random;
import static org.junit.Assert.assertEquals;
public class MainActivityTest {
private final static String TAG = "MainActivityTest";
@Test
public void setDeviceNumberList() {
final MainActivity activity = new MainActivity();
final Random r = new Random();
ArrayList<Integer> list = new ArrayList<Integer>();
activity.setDeviceNumberList(list);
assertEquals(list, activity.getDeviceNumberList());
list.add(r.nextInt(30000));
activity.setDeviceNumberList(list);
assertEquals(list, activity.getDeviceNumberList());
for (int i = 0; i < 400; ++i) {
list.add(r.nextInt(list.size()), r.nextInt(60000));
activity.setDeviceNumberList(list);
assertEquals(list, activity.getDeviceNumberList());
list.add(r.nextInt(list.size()), r.nextInt(60000));
activity.setDeviceNumberList(list);
assertEquals(list, activity.getDeviceNumberList());
list.remove(r.nextInt(list.size() - 1));
activity.setDeviceNumberList(list);
assertEquals(list, activity.getDeviceNumberList());
}
}
}
|