summaryrefslogtreecommitdiff
path: root/app/src/test/java/com/javispedro/rempe
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/java/com/javispedro/rempe')
-rw-r--r--app/src/test/java/com/javispedro/rempe/MainActivityTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/src/test/java/com/javispedro/rempe/MainActivityTest.java b/app/src/test/java/com/javispedro/rempe/MainActivityTest.java
new file mode 100644
index 0000000..fe0f4c5
--- /dev/null
+++ b/app/src/test/java/com/javispedro/rempe/MainActivityTest.java
@@ -0,0 +1,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());
+ }
+ }
+} \ No newline at end of file