5
5
package at.bitfire.davdroid.sync
6
6
7
7
import android.accounts.Account
8
- import android.content.Context
9
8
import android.content.SyncResult
10
9
import at.bitfire.dav4jvm.DavCollection
11
10
import at.bitfire.dav4jvm.MultiResponseCallback
12
11
import at.bitfire.dav4jvm.Response
13
12
import at.bitfire.dav4jvm.property.caldav.GetCTag
14
- import at.bitfire.davdroid.db.AppDatabase
15
13
import at.bitfire.davdroid.db.Collection
16
14
import at.bitfire.davdroid.db.SyncState
17
15
import at.bitfire.davdroid.network.HttpClient
18
16
import at.bitfire.davdroid.resource.LocalResource
19
17
import at.bitfire.davdroid.settings.AccountSettings
20
- import at.bitfire.davdroid.ui.NotificationRegistry
21
18
import at.bitfire.davdroid.util.lastSegment
19
+ import dagger.assisted.Assisted
20
+ import dagger.assisted.AssistedFactory
21
+ import dagger.assisted.AssistedInject
22
22
import okhttp3.HttpUrl
23
23
import okhttp3.RequestBody
24
24
import okhttp3.RequestBody.Companion.toRequestBody
25
25
import org.junit.Assert.assertEquals
26
26
27
- class TestSyncManager (
28
- account : Account ,
29
- accountSettings : AccountSettings ,
30
- extras : Array <String >,
31
- authority : String ,
32
- httpClient : HttpClient ,
33
- syncResult : SyncResult ,
34
- localCollection : LocalTestCollection ,
35
- collection : Collection ,
36
- context : Context ,
37
- db : AppDatabase ,
38
- notificationRegistry : NotificationRegistry
27
+ class TestSyncManager @AssistedInject constructor(
28
+ @Assisted account : Account ,
29
+ @Assisted accountSettings : AccountSettings ,
30
+ @Assisted extras : Array <String >,
31
+ @Assisted authority : String ,
32
+ @Assisted httpClient : HttpClient ,
33
+ @Assisted syncResult : SyncResult ,
34
+ @Assisted localCollection : LocalTestCollection ,
35
+ @Assisted collection : Collection
39
36
): SyncManager<LocalTestResource, LocalTestCollection, DavCollection>(
40
37
account,
41
38
accountSettings,
@@ -44,12 +41,23 @@ class TestSyncManager(
44
41
authority,
45
42
syncResult,
46
43
localCollection,
47
- collection,
48
- context,
49
- db,
50
- notificationRegistry
44
+ collection
51
45
) {
52
46
47
+ @AssistedFactory
48
+ interface Factory {
49
+ fun create (
50
+ account : Account ,
51
+ accountSettings : AccountSettings ,
52
+ extras : Array <String >,
53
+ authority : String ,
54
+ httpClient : HttpClient ,
55
+ syncResult : SyncResult ,
56
+ localCollection : LocalTestCollection ,
57
+ collection : Collection
58
+ ): TestSyncManager
59
+ }
60
+
53
61
override fun prepare (): Boolean {
54
62
davCollection = DavCollection (httpClient.okHttpClient, collection.url)
55
63
return true
0 commit comments