Moved tests over to Kotlin. (#1428)

This commit is contained in:
Paul Hawke 2018-04-08 02:59:20 -05:00 committed by Josephine Lim
parent 6b2dd8c1df
commit 22772c851e
29 changed files with 1453 additions and 1679 deletions

View file

@ -0,0 +1,23 @@
package fr.free.nrw.commons
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class, sdk = intArrayOf(21), application = TestCommonsApplication::class)
class MediaTest {
@Test
fun displayTitleShouldStripExtension() {
val m = Media("File:Example.jpg")
assertEquals("Example", m.displayTitle)
}
@Test
fun displayTitleShouldUseSpaceForUnderscore() {
val m = Media("File:Example 1_2.jpg")
assertEquals("Example 1 2", m.displayTitle)
}
}