Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2576dc6e authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Rewrite tests to Kotlin

parent acd0fa98
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -24,11 +24,14 @@ Generated KDoc: https://bitfireAT.gitlab.io/ical4android/dokka/ical4android/

```
bitfire web engineering – Stockmann, Hirner GesnbR
Liniengasse 6/3/28
Florastraße 27
2540 Bad Vöslau, AUSTRIA
```

Email: [play@bitfire.at](mailto:play@bitfire.at)
Email: [play@bitfire.at](mailto:play@bitfire.at) (do not use this)

For questions, suggestions etc. please use the DAVdroid forum:
https://www.davdroid.com/forums/


## License 
+2 −30
Original line number Diff line number Diff line
@@ -5,9 +5,7 @@ buildscript {

    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        google()
    }

    dependencies {
@@ -19,9 +17,7 @@ buildscript {

repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
    google()
}

apply plugin: 'com.android.library'
@@ -68,28 +64,4 @@ dependencies {
    androidTestCompile 'com.android.support.test:rules:1.0.1'

    testCompile 'junit:junit:4.12'
    testCompileOnly 'org.projectlombok:lombok:1.16.20'
}

// grant permissions for unit tests
task grantPermissions(dependsOn: 'installDebugAndroidTest') {
    doFirst {
        def adb = android.getAdbExe().toString()

        // grant permissions
        [
                'android.permission.READ_CALENDAR',
                'android.permission.WRITE_CALENDAR',
                'org.dmfs.permission.READ_TASKS',
                'org.dmfs.permission.WRITE_TASKS'
        ].each {
            "${adb} shell pm grant at.bitfire.ical4android.test ${it}".execute()
        }
    }
}

tasks.whenTaskAdded { task ->
    if (task.name.startsWith('connectedDebugAndroidTest')) {
        task.dependsOn grantPermissions
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ abstract class AndroidEvent(
            if (idNS != null || id != null) {
                // attendee identified by namespace and ID
                attendee = Attendee(URI(idNS, id, null))
                email?.let { attendee.parameters.add(iCalendar.Email(it)) }
                email?.let { attendee.parameters.add(ICalendar.Email(it)) }
            } else
                // attendee identified by email address
                attendee = Attendee(URI("mailto", email, null))
@@ -560,7 +560,7 @@ abstract class AndroidEvent(
            if (uri.scheme.equals("mailto", true))
                email = uri.schemeSpecificPart
            else {
                val emailParam = organizer.getParameter(iCalendar.Email.PARAMETER_NAME) as iCalendar.Email?
                val emailParam = organizer.getParameter(ICalendar.Email.PARAMETER_NAME) as ICalendar.Email?
                email = emailParam?.value
            }
            if (email != null)
@@ -599,7 +599,7 @@ abstract class AndroidEvent(
            else               -> Reminders.METHOD_DEFAULT
        }

        val minutes = iCalendar.alarmMinBefore(alarm)
        val minutes = ICalendar.alarmMinBefore(alarm)
        builder .withValue(Reminders.METHOD, method)
                .withValue(Reminders.MINUTES, minutes)

@@ -618,7 +618,7 @@ abstract class AndroidEvent(
            // attendee identified by other URI
            builder .withValue(Attendees.ATTENDEE_ID_NAMESPACE, member.scheme)
                    .withValue(Attendees.ATTENDEE_IDENTITY, member.schemeSpecificPart)
            (attendee.getParameter(iCalendar.Email.PARAMETER_NAME) as iCalendar.Email?)?.let { email ->
            (attendee.getParameter(ICalendar.Email.PARAMETER_NAME) as ICalendar.Email?)?.let { email ->
                builder.withValue(Attendees.ATTENDEE_EMAIL, email.value)
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@

package at.bitfire.ical4android

@Deprecated("Do not wrap calendar IPC exceptions if you don't need to.")
@Deprecated("Unnecessary generic wrapper around RemoteException")
class CalendarStorageException: Exception {

    constructor(message: String): super(message)
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import java.io.OutputStream
import java.io.Reader
import java.util.*

class Event: iCalendar() {
class Event: ICalendar() {

    // uid and sequence are inherited from iCalendar
    var recurrenceId: RecurrenceId? = null
@@ -153,7 +153,7 @@ class Event: iCalendar() {


        @Throws(InvalidCalendarException::class)
        fun fromVEvent(event: VEvent): Event {
        private fun fromVEvent(event: VEvent): Event {
            val e = Event()

            // sequence must only be null for locally created, not-yet-synchronized events
Loading