mirror of
https://github.com/leanote/leanote-android.git
synced 2025-10-14 06:07:38 +00:00
support kotlin
This commit is contained in:
@@ -13,6 +13,7 @@ repositories {
|
||||
maven { url "http://dl.bintray.com/piasy/maven" }
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
def dbflow_version = "4.0.0-beta2"
|
||||
def ciName = isEmpty(System.getenv("TRAVIS_TAG")) ? "Staging" : System.getenv("TRAVIS_TAG")
|
||||
@@ -107,4 +108,7 @@ dependencies {
|
||||
implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
|
||||
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
testImplementation "org.mockito:mockito-core:2.+"
|
||||
}
|
||||
|
37
app/src/test/java/org/houxg/leamonax/FileUtilsTest.kt
Normal file
37
app/src/test/java/org/houxg/leamonax/FileUtilsTest.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package org.houxg.leamonax
|
||||
|
||||
import junit.framework.Assert
|
||||
import org.houxg.leamonax.utils.FileUtils
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.Mockito.mock
|
||||
import java.io.File
|
||||
|
||||
class FileUtilsTest {
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testIsImageFile() {
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.jpeg", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.jpg", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.png", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.gif", true)))
|
||||
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.JPEG", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.JPG", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.PNG", true)))
|
||||
Assert.assertEquals(true, FileUtils.isImageFile(getMockFile("a.GIF", true)))
|
||||
}
|
||||
|
||||
private fun getMockFile(name: String, isFile: Boolean): File {
|
||||
val mock = mock(File::class.java)
|
||||
`when`(mock.isFile).thenReturn(isFile)
|
||||
`when`(mock.name).thenReturn(name)
|
||||
return mock
|
||||
}
|
||||
}
|
@@ -1,12 +1,14 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.11'
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
Reference in New Issue
Block a user