Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/UtilsTest.java

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: minor codestyle fixes Created Oct. 20, 2016, 1:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 package org.adblockplus.libadblockplus.tests;
2
3 import org.adblockplus.android.Utils;
4 import org.junit.Test;
5
6 import java.util.Arrays;
7 import java.util.LinkedList;
8 import java.util.List;
9
10 /**
11 * Test for Utils
12 */
13 public class UtilsTest extends BaseJsTest
14 {
15 @Test
16 public void testJson_null()
17 {
18 final List<String> list = null;
19 String json = Utils.stringListToJsonArray(list);
20 assertEquals("[]", json);
21 }
22
23 @Test
24 public void testJson_single()
25 {
26 final List<String> list = Arrays.asList("string1");
27 String json = Utils.stringListToJsonArray(list);
28 assertEquals("[\"string1\"]", json);
29 }
30
31 @Test
32 public void testJson_multiple()
33 {
34 final List<String> list = Arrays.asList("string1", "string2");
35 String json = Utils.stringListToJsonArray(list);
36 assertEquals("[\"string1\",\"string2\"]", json);
37 }
38
39 @Test
40 public void testJson_multipleWithNull()
41 {
42 final List<String> list = Arrays.asList("string1", null, "string2");
43 String json = Utils.stringListToJsonArray(list);
44 assertEquals("[\"string1\",\"string2\"]", json);
45 }
46
47 @Test
48 public void testJson_singleWithNull()
49 {
50 final List<String> list = new LinkedList<String>();
51 list.add(null);
52 String json = Utils.stringListToJsonArray(list);
53 assertEquals("[]", json);
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld