summaryrefslogtreecommitdiff
path: root/app/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/java/android/util/Log.java23
-rw-r--r--app/src/test/java/com/javispedro/rempe/MainActivityTest.java40
2 files changed, 63 insertions, 0 deletions
diff --git a/app/src/test/java/android/util/Log.java b/app/src/test/java/android/util/Log.java
new file mode 100644
index 0000000..e117d5d
--- /dev/null
+++ b/app/src/test/java/android/util/Log.java
@@ -0,0 +1,23 @@
+package android.util;
+
+public class Log {
+ public static int d(String tag, String msg) {
+ System.err.println("DEBUG: " + tag + ": " + msg);
+ return 0;
+ }
+
+ public static int i(String tag, String msg) {
+ System.err.println("INFO: " + tag + ": " + msg);
+ return 0;
+ }
+
+ public static int w(String tag, String msg) {
+ System.err.println("WARN: " + tag + ": " + msg);
+ return 0;
+ }
+
+ public static int e(String tag, String msg) {
+ System.err.println("ERROR: " + tag + ": " + msg);
+ return 0;
+ }
+}
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