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

Delta Between Two Patch Sets: adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt

Issue 29603697: Issue 5931 - Create tests for util package (Closed)
Left Patch Set: Moved files with hg mv Created Nov. 14, 2017, 2:43 p.m.
Right Patch Set: Removed default srcDir Created Nov. 30, 2017, 8:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 import org.junit.Test 28 import org.junit.Test
29 import org.junit.runner.RunWith 29 import org.junit.runner.RunWith
30 import org.mockito.Mockito.mock 30 import org.mockito.Mockito.mock
31 import org.robolectric.RobolectricTestRunner 31 import org.robolectric.RobolectricTestRunner
32 import org.robolectric.RuntimeEnvironment 32 import org.robolectric.RuntimeEnvironment
33 import java.util.Locale 33 import java.util.Locale
34 34
35 @RunWith(RobolectricTestRunner::class) 35 @RunWith(RobolectricTestRunner::class)
36 class UtilsTest 36 class UtilsTest
37 { 37 {
38 38 private lateinit var mockedDefaultSubs: DefaultSubscriptions
anton 2017/11/16 10:46:36 the line seems to be not required
jens 2017/11/17 09:16:26 Acknowledged.
39 private var mockedDefaultSubs: DefaultSubscriptions? = null
anton 2017/11/16 10:46:36 shouldn't it be 'lateinit var .. ' too? it's init
jens 2017/11/17 09:16:26 Yeah, you are right. That is the proper way to do
40 private lateinit var context: Context 39 private lateinit var context: Context
41 private val EASYLIST_GERMANY_COMPLETE_URL = 40 private val EASYLIST_GERMANY_COMPLETE_URL =
42 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist .txt" 41 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist .txt"
43 42
44 @Before 43 @Before
45 fun setup() 44 fun setup()
46 { 45 {
47 context = RuntimeEnvironment.application 46 context = RuntimeEnvironment.application
48 mockedDefaultSubs = mock(DefaultSubscriptions::class.java) 47 mockedDefaultSubs = mock(DefaultSubscriptions::class.java)
49 RuntimeEnvironment.application.resources 48 RuntimeEnvironment.application.resources
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 @Test 154 @Test
156 fun sharedPrefsUtilsPutAndGetDifferentStringSet() 155 fun sharedPrefsUtilsPutAndGetDifferentStringSet()
157 { 156 {
158 val testStringSet = setOf("Hello", "World") 157 val testStringSet = setOf("Hello", "World")
159 SharedPrefsUtils.putStringSet(context, R.string.key_previous_version_cod e, testStringSet) 158 SharedPrefsUtils.putStringSet(context, R.string.key_previous_version_cod e, testStringSet)
160 val unequalStringSet = SharedPrefsUtils.getStringSet(context, 159 val unequalStringSet = SharedPrefsUtils.getStringSet(context,
161 R.string.key_aa_info_shown, setOf("Hello", "World", "!")) 160 R.string.key_aa_info_shown, setOf("Hello", "World", "!"))
162 assertNotEquals(testStringSet, unequalStringSet) 161 assertNotEquals(testStringSet, unequalStringSet)
163 } 162 }
164 } 163 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld