Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

Commit 82b2dcb

Browse files
rfc2822sunkup
andauthored
Move vcard4android classes to new packages (#393)
* Move to new packages * Move utils and tests * Update import for Utils.trimToNull in DescriptionBuilder and LocationBuilder --------- Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>
1 parent 18c58e9 commit 82b2dcb

105 files changed

Lines changed: 393 additions & 350 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/src/androidTest/kotlin/at/bitfire/vcard4android/TestUtils.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/mapping/contacts/TestUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android
7+
package at.bitfire.synctools.mapping.contacts
88

99
object TestUtils {
1010

@@ -16,4 +16,4 @@ object TestUtils {
1616
fun resourceToByteArray(resource: String): ByteArray =
1717
this::class.java.getResourceAsStream(resource)!!.use { it.readBytes() }
1818

19-
}
19+
}

lib/src/androidTest/kotlin/at/bitfire/vcard4android/contactrow/PhotoBuilderTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/mapping/contacts/builder/PhotoBuilderTest.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android.contactrow
7+
package at.bitfire.synctools.mapping.contacts.builder
88

99
import android.Manifest
1010
import android.accounts.Account
@@ -16,11 +16,14 @@ import android.provider.ContactsContract
1616
import android.provider.ContactsContract.RawContacts
1717
import androidx.test.platform.app.InstrumentationRegistry
1818
import androidx.test.rule.GrantPermissionRule
19-
import at.bitfire.vcard4android.AndroidContact
20-
import at.bitfire.vcard4android.Contact
21-
import at.bitfire.vcard4android.TestUtils
22-
import at.bitfire.vcard4android.impl.TestAddressBook
23-
import org.junit.Assert.*
19+
import at.bitfire.synctools.mapping.contacts.Contact
20+
import at.bitfire.synctools.mapping.contacts.TestUtils
21+
import at.bitfire.synctools.storage.contacts.AndroidContact
22+
import at.bitfire.synctools.storage.contacts.TestAddressBook
23+
import org.junit.Assert.assertEquals
24+
import org.junit.Assert.assertNotNull
25+
import org.junit.Assert.assertNull
26+
import org.junit.Assert.assertTrue
2427
import org.junit.BeforeClass
2528
import org.junit.ClassRule
2629
import org.junit.Test

lib/src/androidTest/kotlin/at/bitfire/vcard4android/contactrow/PhotoHandlerTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/mapping/contacts/handler/PhotoHandlerTest.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android.contactrow
7+
package at.bitfire.synctools.mapping.contacts.handler
88

99
import android.Manifest
1010
import android.accounts.Account
@@ -16,16 +16,22 @@ import android.provider.ContactsContract.CommonDataKinds.Photo
1616
import android.provider.ContactsContract.RawContacts
1717
import androidx.test.platform.app.InstrumentationRegistry
1818
import androidx.test.rule.GrantPermissionRule
19-
import at.bitfire.vcard4android.AndroidContact
20-
import at.bitfire.vcard4android.Contact
21-
import at.bitfire.vcard4android.TestUtils
22-
import at.bitfire.vcard4android.impl.TestAddressBook
19+
import at.bitfire.synctools.mapping.contacts.Contact
20+
import at.bitfire.synctools.mapping.contacts.TestUtils
21+
import at.bitfire.synctools.storage.contacts.AndroidContact
22+
import at.bitfire.synctools.storage.contacts.TestAddressBook
2323
import org.junit.Assert
24-
import org.junit.Assert.*
24+
import org.junit.Assert.assertArrayEquals
25+
import org.junit.Assert.assertEquals
26+
import org.junit.Assert.assertFalse
27+
import org.junit.Assert.assertNotEquals
28+
import org.junit.Assert.assertNotNull
29+
import org.junit.Assert.assertNull
30+
import org.junit.Assert.assertTrue
2531
import org.junit.BeforeClass
2632
import org.junit.ClassRule
2733
import org.junit.Test
28-
import java.util.*
34+
import java.util.Arrays
2935

3036
class PhotoHandlerTest {
3137

lib/src/androidTest/kotlin/at/bitfire/vcard4android/AndroidAddressBookTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/AndroidAddressBookTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android
7+
package at.bitfire.synctools.storage.contacts
88

99
import android.Manifest
1010
import android.accounts.Account
@@ -13,7 +13,7 @@ import android.content.ContentValues
1313
import android.provider.ContactsContract
1414
import androidx.test.platform.app.InstrumentationRegistry
1515
import androidx.test.rule.GrantPermissionRule
16-
import at.bitfire.vcard4android.impl.TestAddressBook
16+
import at.bitfire.synctools.mapping.contacts.Contact
1717
import org.junit.Assert.assertArrayEquals
1818
import org.junit.Assert.assertEquals
1919
import org.junit.Assert.assertFalse

lib/src/androidTest/kotlin/at/bitfire/vcard4android/AndroidContactTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/AndroidContactTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android
7+
package at.bitfire.synctools.storage.contacts
88

99
import android.Manifest
1010
import android.accounts.Account
@@ -14,10 +14,10 @@ import android.util.Base64
1414
import androidx.test.filters.MediumTest
1515
import androidx.test.platform.app.InstrumentationRegistry
1616
import androidx.test.rule.GrantPermissionRule
17+
import at.bitfire.synctools.mapping.contacts.Contact
18+
import at.bitfire.synctools.mapping.contacts.LabeledProperty
1719
import at.bitfire.synctools.storage.LocalStorageException
18-
import at.bitfire.vcard4android.impl.TestAddressBook
19-
import at.bitfire.vcard4android.impl.testProductId
20-
import at.bitfire.vcard4android.property.XAbDate
20+
import at.bitfire.synctools.vcard.property.XAbDate
2121
import ezvcard.VCardVersion
2222
import ezvcard.property.Address
2323
import ezvcard.property.Birthday

lib/src/androidTest/kotlin/at/bitfire/vcard4android/AndroidGroupTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/AndroidGroupTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android
7+
package at.bitfire.synctools.storage.contacts
88

99
import android.Manifest
1010
import android.accounts.Account
1111
import android.content.ContentProviderClient
1212
import android.provider.ContactsContract
1313
import androidx.test.platform.app.InstrumentationRegistry
1414
import androidx.test.rule.GrantPermissionRule
15-
import at.bitfire.vcard4android.impl.TestAddressBook
15+
import at.bitfire.synctools.mapping.contacts.Contact
1616
import org.junit.After
1717
import org.junit.Assert.assertEquals
1818
import org.junit.Assert.assertNotNull

lib/src/androidTest/kotlin/at/bitfire/vcard4android/impl/Constants.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/Constants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android.impl
7+
package at.bitfire.synctools.storage.contacts
88

99
val testProductId = "bitfireAT/synctools test"

lib/src/androidTest/kotlin/at/bitfire/vcard4android/impl/TestAddressBook.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/storage/contacts/TestAddressBook.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android.impl
7+
package at.bitfire.synctools.storage.contacts
88

99
import android.accounts.Account
1010
import android.content.ContentProviderClient
1111
import android.content.ContentValues
12-
import at.bitfire.vcard4android.*
1312

1413
class TestAddressBook(
15-
account: Account,
16-
provider: ContentProviderClient
14+
account: Account,
15+
provider: ContentProviderClient
1716
): AndroidAddressBook<AndroidContact, AndroidGroup>(account, provider, ContactFactory, GroupFactory) {
1817

1918
object ContactFactory: AndroidContactFactory<AndroidContact> {
@@ -30,5 +29,5 @@ class TestAddressBook(
3029
AndroidGroup(addressBook, values)
3130

3231
}
33-
32+
3433
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* This file is part of bitfireAT/synctools which is released under GPLv3.
3+
* Copyright © All Contributors. See the LICENSE and AUTHOR files in the root directory for details.
4+
* SPDX-License-Identifier: GPL-3.0-or-later
5+
*/
6+
7+
package at.bitfire.synctools.util
8+
9+
import at.bitfire.synctools.util.Utils.capitalize
10+
import at.bitfire.synctools.util.Utils.trimToNull
11+
import org.junit.Assert
12+
import org.junit.Test
13+
14+
class UtilsTest {
15+
@Test
16+
fun testCapitalize() {
17+
Assert.assertEquals("Utils Test", "utils test".capitalize()) // Test multiple words
18+
Assert.assertEquals("Utils", "utils".capitalize()) // Test single word
19+
Assert.assertEquals("", "".capitalize()) // Test empty string
20+
}
21+
22+
@Test
23+
fun testTrimToNull() {
24+
Assert.assertEquals("test", " test".trimToNull()) // Test spaces only before
25+
Assert.assertEquals("test", "test ".trimToNull()) // Test spaces only after
26+
Assert.assertEquals("test", " test ".trimToNull()) // Test spaces before and after
27+
Assert.assertNull(" ".trimToNull()) // Test spaces
28+
Assert.assertNull("".trimToNull()) // Test empty string
29+
}
30+
}

lib/src/test/kotlin/at/bitfire/vcard4android/LocaleNonWesternDigitsTest.kt renamed to lib/src/androidTest/kotlin/at/bitfire/synctools/vcard/LocaleNonWesternDigitsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.vcard4android
7+
package at.bitfire.synctools.vcard
88

99
import ezvcard.Ezvcard
1010
import ezvcard.VCard

0 commit comments

Comments
 (0)