Commit 913105c5 authored by Ricki Hirner's avatar Ricki Hirner

Update to SDK level 28 and AndroidX

parent 999c499c
buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.10'
ext.dokka_version = '0.9.17'
repositories {
......@@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:${dokka_version}"
}
......@@ -36,7 +36,7 @@ android {
minSdkVersion 19
targetSdkVersion 28
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "version_ical4j", "\"$ical4j_version\""
}
......@@ -66,8 +66,8 @@ dependencies {
api "org.mnode.ical4j:ical4j:$ical4j_version"
implementation 'org.slf4j:slf4j-jdk14:1.7.25'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
testImplementation 'junit:junit:4.12'
}
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
......@@ -15,9 +15,9 @@ import android.content.ContentUris
import android.content.ContentValues
import android.os.Build
import android.provider.CalendarContract
import android.support.test.InstrumentationRegistry
import android.support.test.filters.MediumTest
import android.support.test.rule.GrantPermissionRule
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule
import at.bitfire.ical4android.impl.TestCalendar
import org.junit.After
import org.junit.Assert.assertEquals
......@@ -41,7 +41,7 @@ class AndroidCalendarTest {
@Before
fun prepare() {
provider = InstrumentationRegistry.getInstrumentation().targetContext.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)
provider = InstrumentationRegistry.getInstrumentation().targetContext.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)!!
}
@After
......
......@@ -15,9 +15,9 @@ import android.content.ContentValues
import android.net.Uri
import android.os.Build
import android.provider.CalendarContract
import android.support.test.InstrumentationRegistry.getInstrumentation
import android.support.test.filters.MediumTest
import android.support.test.rule.GrantPermissionRule
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.GrantPermissionRule
import at.bitfire.ical4android.AndroidCalendar.Companion.syncAdapterURI
import at.bitfire.ical4android.impl.TestCalendar
import at.bitfire.ical4android.impl.TestEvent
......@@ -53,7 +53,7 @@ class AndroidEventTest {
@Before
fun prepare() {
provider = getInstrumentation().targetContext.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)
provider = getInstrumentation().targetContext.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)!!
AndroidCalendar.insertColors(provider, testAccount)
......
......@@ -11,8 +11,8 @@ package at.bitfire.ical4android
import android.accounts.Account
import android.content.ContentUris
import android.content.ContentValues
import android.support.test.InstrumentationRegistry.getInstrumentation
import android.support.test.filters.MediumTest
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import at.bitfire.ical4android.impl.TestTaskList
import org.dmfs.tasks.contract.TaskContract
import org.junit.After
......
......@@ -11,8 +11,8 @@ package at.bitfire.ical4android
import android.accounts.Account
import android.content.ContentUris
import android.net.Uri
import android.support.test.InstrumentationRegistry.getInstrumentation
import android.support.test.filters.MediumTest
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import at.bitfire.ical4android.impl.TestTask
import at.bitfire.ical4android.impl.TestTaskList
import net.fortuna.ical4j.model.Date
......
......@@ -9,7 +9,7 @@
package at.bitfire.ical4android
import android.content.ContentValues
import android.support.test.filters.SmallTest
import androidx.test.filters.SmallTest
import net.fortuna.ical4j.data.CalendarBuilder
import net.fortuna.ical4j.model.Date
import net.fortuna.ical4j.model.DateTime
......@@ -98,6 +98,7 @@ class MiscUtilsTest {
}
@Suppress("unused")
private class TestClass {
private val s = "test"
val i = 2
......
......@@ -8,7 +8,7 @@
package at.bitfire.ical4android
import android.support.test.runner.permission.PermissionRequester
import androidx.test.runner.permission.PermissionRequester
import junit.framework.AssertionFailedError
object TestUtils {
......
......@@ -44,7 +44,8 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
info.put(Calendars.ALLOWED_ATTENDEE_TYPES, "${Attendees.TYPE_NONE},${Attendees.TYPE_OPTIONAL},${Attendees.TYPE_REQUIRED},${Attendees.TYPE_RESOURCE}")
Constants.log.info("Creating local calendar: " + info.toString())
return provider.insert(syncAdapterURI(Calendars.CONTENT_URI, account), info)
return provider.insert(syncAdapterURI(Calendars.CONTENT_URI, account), info) ?:
throw Exception("Couldn't create calendar: provider returned null")
}
fun insertColors(provider: ContentProviderClient, account: Account) {
......
......@@ -11,7 +11,6 @@ import org.junit.Assert.*
import org.junit.Test
import java.io.FileNotFoundException
import java.io.InputStreamReader
import java.lang.AssertionError
import java.nio.charset.Charset
class EventTest {
......@@ -20,7 +19,7 @@ class EventTest {
@Test
fun testCalendarProperties() {
javaClass.classLoader.getResourceAsStream("events/multiple.ics").use { stream ->
javaClass.classLoader!!.getResourceAsStream("events/multiple.ics").use { stream ->
val properties = mutableMapOf<String, String>()
Event.fromReader(InputStreamReader(stream, Charsets.UTF_8), properties)
assertEquals(1, properties.size)
......@@ -201,7 +200,7 @@ class EventTest {
}
private fun parseCalendar(fname: String, charset: Charset = Charsets.UTF_8): List<Event> =
javaClass.classLoader.getResourceAsStream("events/$fname").use { stream ->
javaClass.classLoader!!.getResourceAsStream("events/$fname").use { stream ->
return Event.fromReader(InputStreamReader(stream, charset))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment