File tree 5 files changed +8
-7
lines changed
androidTest/java/fr/free/nrw/commons
main/java/fr/free/nrw/commons
test/kotlin/fr/free/nrw/commons/actions
5 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class AboutActivityTest {
105
105
fun testLaunchTranslate () {
106
106
Espresso .onView(ViewMatchers .withId(R .id.about_translate)).perform(ViewActions .click())
107
107
Espresso .onView(ViewMatchers .withId(android.R .id.button1)).perform(ViewActions .click())
108
- val langCode = CommonsApplication .getInstance() .languageLookUpTable.codes[0 ]
108
+ val langCode = CommonsApplication .instance .languageLookUpTable!! .codes[0 ]
109
109
Intents .intended(
110
110
CoreMatchers .allOf(
111
111
IntentMatchers .hasAction(Intent .ACTION_VIEW ),
Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ class CommonsApplication : MultiDexApplication() {
85
85
@Inject
86
86
lateinit var customOkHttpNetworkFetcher: CustomOkHttpNetworkFetcher
87
87
88
- // TODO [parry] not being used anywhere, remove after checking
89
88
var languageLookUpTable: AppLanguageLookUpTable ? = null
90
89
private set
91
90
@@ -385,7 +384,9 @@ class CommonsApplication : MultiDexApplication() {
385
384
/* *
386
385
* Constants End
387
386
*/
388
- var instance: CommonsApplication ? = null
387
+
388
+ @JvmStatic
389
+ lateinit var instance: CommonsApplication
389
390
private set
390
391
391
392
@JvmField
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ class ThanksClient
32
32
revisionId.toString(), // Rev
33
33
null , // Log
34
34
csrfTokenClient.getTokenBlocking(), // Token
35
- CommonsApplication .getInstance() .userAgent, // Source
35
+ CommonsApplication .instance .userAgent, // Source
36
36
).map { mwThankPostResponse ->
37
37
mwThankPostResponse.result?.success == 1
38
38
}
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ class DescriptionEditActivity :
258
258
username,
259
259
)
260
260
261
- val commonsApplication = CommonsApplication .getInstance()
261
+ val commonsApplication = CommonsApplication .instance
262
262
if (commonsApplication != null ) {
263
263
commonsApplication.clearApplicationData(this , logoutListener)
264
264
}
@@ -291,7 +291,7 @@ class DescriptionEditActivity :
291
291
username,
292
292
)
293
293
294
- val commonsApplication = CommonsApplication .getInstance()
294
+ val commonsApplication = CommonsApplication .instance
295
295
if (commonsApplication != null ) {
296
296
commonsApplication.clearApplicationData(this , logoutListener)
297
297
}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class ThanksClientTest {
39
39
fun setUp () {
40
40
MockitoAnnotations .openMocks(this )
41
41
mockedApplication = Mockito .mockStatic(CommonsApplication ::class .java)
42
- `when `(CommonsApplication .getInstance() ).thenReturn(commonsApplication)
42
+ `when `(CommonsApplication .instance ).thenReturn(commonsApplication)
43
43
thanksClient = ThanksClient (csrfTokenClient, service)
44
44
}
45
45
You can’t perform that action at this time.
0 commit comments