[Android] Unit test for Util.insertOrUdpate()

Geoffrey Métais git at videolan.org
Wed Dec 20 12:59:20 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 20 12:39:14 2017 +0100| [e3eeb003d98c997d2efdb1579ff9704414de267c] | committer: Geoffrey Métais

Unit test for Util.insertOrUdpate()

> https://code.videolan.org/videolan/vlc-android/commit/e3eeb003d98c997d2efdb1579ff9704414de267c
---

 .../test/org/videolan/vlc/util/UtilTest.java       | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/vlc-android/test/org/videolan/vlc/util/UtilTest.java b/vlc-android/test/org/videolan/vlc/util/UtilTest.java
new file mode 100644
index 000000000..887613a1e
--- /dev/null
+++ b/vlc-android/test/org/videolan/vlc/util/UtilTest.java
@@ -0,0 +1,29 @@
+package org.videolan.vlc.util;
+
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class UtilTest {
+
+    @Test
+    public void testInsertOrUdpate() {
+        String a = "a";
+        String b = "b";
+        String c = "c";
+        String b2 = new String(b);
+        List<String> list = new ArrayList<>();
+        list.add(a);
+        list.add(b);
+        String[] items = {c, b2 };
+        Util.insertOrUdpate(list, items);
+        assertEquals(list.get(1), b2);
+        assertEquals(b, b2);
+        assertEquals(true, list.get(1) == b2);
+        assertEquals(list.get(2), c);
+    }
+}



More information about the Android mailing list