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

Issue 29603697: Issue 5931 - Create tests for util package (Closed)

Created:
Nov. 10, 2017, 1:48 p.m. by jens
Modified:
Nov. 30, 2017, 3:53 p.m.
Reviewers:
anton, diegocarloslima
CC:
René Jeschke
Visibility:
Public.

Description

I would prefer to adjust the project structure to what you get when you start a new project with android studio. Therefor I needed to move all java files so src/main/java. At the moment I have no idea how we could run instrumentation test with espresso for ABP for Samsung. We cannot mock the static methods of the Engine class to emulate an environment with a Samsung Browser installed. It might make sense to refactor our code to have a better tests coverage, but I think we should start with unit tests first.

Patch Set 1 #

Total comments: 7

Patch Set 2 : Moved files with hg mv #

Total comments: 5

Patch Set 3 : Deleted empty line and changed DefaultSubscriptions to lateinit #

Patch Set 4 : Removed default srcDir #

Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, --23 lines) Patch
M adblockplussbrowser/build.gradle View 1 2 3 2 chunks +9 lines, -1 line 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/ConnectivityChanged.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/ContentBlockerContentProvider.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/InputValidatorDialogPreference.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/ListedSubscriptionsPreferenceCategory.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/MainPreferences.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/MoreBlockingPreferenceCategory.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/Preferences.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/WhitelistedWebsitesPreferenceCategory.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/AppInfo.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/DefaultSubscriptionInfo.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/DefaultSubscriptions.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Downloader.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Engine.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/EngineService.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/JSONPrefs.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscription.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/SubscriptionInfo.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/preferences/ImprintPreference.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/preferences/MultilineCheckBoxPreference.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/preferences/MultilineListPreference.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/preferences/MultilinePreferenceCategory.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/PreferenceUtils.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/SharedPrefsUtils.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/SubscriptionUtils.java View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
A adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt View 1 2 3 1 chunk +163 lines, -0 lines 0 comments Download
A adblockplussbrowser/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M build.gradle View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 18
jens
Nov. 10, 2017, 2:37 p.m. (2017-11-10 14:37:36 UTC) #1
anton
On 2017/11/10 14:37:36, jens wrote: First note - though you can use PowerMockito to mock ...
Nov. 13, 2017, 6:03 a.m. (2017-11-13 06:03:33 UTC) #2
diegocarloslima
On 2017/11/13 06:03:33, anton wrote: > On 2017/11/10 14:37:36, jens wrote: > > First note ...
Nov. 13, 2017, 12:35 p.m. (2017-11-13 12:35:30 UTC) #3
diegocarloslima
https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode33 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:33: import java.util.* I don't really like using wildcards on ...
Nov. 13, 2017, 9:10 p.m. (2017-11-13 21:10:13 UTC) #4
anton
https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode40 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:40: private var context: Context? = null it would be ...
Nov. 14, 2017, 6:04 a.m. (2017-11-14 06:04:10 UTC) #5
jens
On 2017/11/13 06:03:33, anton wrote: > On 2017/11/10 14:37:36, jens wrote: > > First note ...
Nov. 14, 2017, 10:50 a.m. (2017-11-14 10:50:24 UTC) #6
jens
On 2017/11/13 12:35:30, diegocarloslima wrote: > On 2017/11/13 06:03:33, anton wrote: > > On 2017/11/10 ...
Nov. 14, 2017, 10:50 a.m. (2017-11-14 10:50:45 UTC) #7
jens
https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode33 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:33: import java.util.* On 2017/11/13 21:10:13, diegocarloslima wrote: > I ...
Nov. 14, 2017, 10:57 a.m. (2017-11-14 10:57:59 UTC) #8
jens
https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode40 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:40: private var context: Context? = null On 2017/11/14 06:04:09, ...
Nov. 14, 2017, 11:03 a.m. (2017-11-14 11:03:55 UTC) #9
jens
On 2017/11/14 11:03:55, jens wrote: > https://codereview.adblockplus.org/29603697/diff/29603864/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt > File > adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt > (right): > > ...
Nov. 14, 2017, 3:18 p.m. (2017-11-14 15:18:50 UTC) #10
anton
https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode38 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:38: the line seems to be not required https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode39 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:39: ...
Nov. 16, 2017, 10:46 a.m. (2017-11-16 10:46:37 UTC) #11
jens
https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt File adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt (right): https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt#newcode38 adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt:38: On 2017/11/16 10:46:36, anton wrote: > the line seems ...
Nov. 17, 2017, 9:16 a.m. (2017-11-17 09:16:26 UTC) #12
anton
On 2017/11/17 09:16:26, jens wrote: > https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt > File > adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt > (right): > > ...
Nov. 17, 2017, 11:59 a.m. (2017-11-17 11:59:34 UTC) #13
jens
On 2017/11/17 11:59:34, anton wrote: > On 2017/11/17 09:16:26, jens wrote: > > > https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/src/test/java/org/adblockplus/sbrowser/contentblocker/engine/UtilsTest.kt ...
Nov. 21, 2017, 9:16 a.m. (2017-11-21 09:16:24 UTC) #14
anton
On 2017/11/21 09:16:24, jens wrote: > On 2017/11/17 11:59:34, anton wrote: > > On 2017/11/17 ...
Nov. 21, 2017, 9:37 a.m. (2017-11-21 09:37:04 UTC) #15
diegocarloslima
https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/build.gradle File adblockplussbrowser/build.gradle (right): https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/build.gradle#newcode24 adblockplussbrowser/build.gradle:24: java.srcDirs = ['src/main/java/'] This can be omitted since it's ...
Nov. 30, 2017, 12:36 a.m. (2017-11-30 00:36:38 UTC) #16
jens
On 2017/11/30 00:36:38, diegocarloslima wrote: > https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/build.gradle > File adblockplussbrowser/build.gradle (right): > > https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser/build.gradle#newcode24 > ...
Nov. 30, 2017, 8:54 a.m. (2017-11-30 08:54:37 UTC) #17
diegocarloslima
Nov. 30, 2017, 2:21 p.m. (2017-11-30 14:21:00 UTC) #18
On 2017/11/30 08:54:37, jens wrote:
> On 2017/11/30 00:36:38, diegocarloslima wrote:
> >
>
https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser...
> > File adblockplussbrowser/build.gradle (right):
> > 
> >
>
https://codereview.adblockplus.org/29603697/diff/29607578/adblockplussbrowser...
> > adblockplussbrowser/build.gradle:24: java.srcDirs = ['src/main/java/']
> > This can be omitted since it's now the default value. I was wondering if
it's
> > worth to move the manifest and the resources to the default directories as
> well.
> > It was originally conceived this way, because we wanted to still keep the
> > project easily configurable in Eclipse, but I think we can move on, only
> > focusing on Android Studio. Maybe would be worth to split all this file
moving
> > into another ticket and keep this review just for the changes directly
related
> > to the util package testing
> 
> Yeah, I already thought about it too. We should also remove sdkVersion,
> versionName and versionNumber from the Manifest. I uploaded a new patch set
> without srcDirs. Let's do the rest in a separate ticket.

LGTM

Powered by Google App Engine
This is Rietveld