mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Migrate junit.framework.Assert.assertEquals to kotlin.test.assertEquals
Also fix some warnings, e.g. shadowed variables.
This commit is contained in:
@@ -20,7 +20,6 @@ package org.isoron.uhabits.acceptance.steps
|
|||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Build.VERSION.SDK_INT
|
import android.os.Build.VERSION.SDK_INT
|
||||||
import android.os.Build.VERSION_CODES
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.test.espresso.Espresso
|
import androidx.test.espresso.Espresso
|
||||||
@@ -33,11 +32,11 @@ import androidx.test.espresso.matcher.ViewMatchers
|
|||||||
import androidx.test.uiautomator.By
|
import androidx.test.uiautomator.By
|
||||||
import androidx.test.uiautomator.UiSelector
|
import androidx.test.uiautomator.UiSelector
|
||||||
import androidx.test.uiautomator.Until
|
import androidx.test.uiautomator.Until
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
import org.isoron.uhabits.BaseUserInterfaceTest
|
import org.isoron.uhabits.BaseUserInterfaceTest
|
||||||
import org.isoron.uhabits.R
|
import org.isoron.uhabits.R
|
||||||
import org.isoron.uhabits.activities.habits.list.ListHabitsActivity
|
import org.isoron.uhabits.activities.habits.list.ListHabitsActivity
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
|
||||||
object CommonSteps : BaseUserInterfaceTest() {
|
object CommonSteps : BaseUserInterfaceTest() {
|
||||||
fun pressBack() {
|
fun pressBack() {
|
||||||
@@ -148,15 +147,19 @@ object CommonSteps : BaseUserInterfaceTest() {
|
|||||||
Screen.LIST_HABITS ->
|
Screen.LIST_HABITS ->
|
||||||
Espresso.onView(ViewMatchers.withClassName(CoreMatchers.endsWith("ListHabitsRootView")))
|
Espresso.onView(ViewMatchers.withClassName(CoreMatchers.endsWith("ListHabitsRootView")))
|
||||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||||
|
|
||||||
Screen.SHOW_HABIT ->
|
Screen.SHOW_HABIT ->
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.subtitleCard))
|
Espresso.onView(ViewMatchers.withId(R.id.subtitleCard))
|
||||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||||
|
|
||||||
Screen.EDIT_HABIT ->
|
Screen.EDIT_HABIT ->
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.questionInput))
|
Espresso.onView(ViewMatchers.withId(R.id.questionInput))
|
||||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||||
|
|
||||||
Screen.SELECT_HABIT_TYPE ->
|
Screen.SELECT_HABIT_TYPE ->
|
||||||
Espresso.onView(ViewMatchers.withText(R.string.yes_or_no_example))
|
Espresso.onView(ViewMatchers.withText(R.string.yes_or_no_example))
|
||||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||||
|
|
||||||
else -> throw IllegalStateException()
|
else -> throw IllegalStateException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ package org.isoron.uhabits.acceptance.steps
|
|||||||
import android.os.Build.VERSION.SDK_INT
|
import android.os.Build.VERSION.SDK_INT
|
||||||
import androidx.test.uiautomator.UiScrollable
|
import androidx.test.uiautomator.UiScrollable
|
||||||
import androidx.test.uiautomator.UiSelector
|
import androidx.test.uiautomator.UiSelector
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.isoron.uhabits.BaseUserInterfaceTest
|
import org.isoron.uhabits.BaseUserInterfaceTest
|
||||||
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
|
||||||
object WidgetSteps {
|
object WidgetSteps {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ class JavaUserFile(val path: Path) : UserFile {
|
|||||||
@Suppress("NewApi")
|
@Suppress("NewApi")
|
||||||
class JavaFileOpener : FileOpener {
|
class JavaFileOpener : FileOpener {
|
||||||
override fun openUserFile(path: String): UserFile {
|
override fun openUserFile(path: String): UserFile {
|
||||||
val path = Paths.get("/tmp/$path")
|
val resolvedPath = Paths.get("/tmp/$path")
|
||||||
return JavaUserFile(path)
|
return JavaUserFile(resolvedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openResourceFile(path: String): ResourceFile {
|
override fun openResourceFile(path: String): ResourceFile {
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ internal class Tokenizer(
|
|||||||
if (s == null || s.isEmpty()) {
|
if (s == null || s.isEmpty()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (s[0].toInt() != mCurrent) {
|
if (s[0].code != mCurrent) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val len = s.length
|
val len = s.length
|
||||||
mStream.mark(len - 1)
|
mStream.mark(len - 1)
|
||||||
for (n in 1 until len) {
|
for (n in 1 until len) {
|
||||||
val value = mStream.read()
|
val value = mStream.read()
|
||||||
if (value != s[n].toInt()) {
|
if (value != s[n].code) {
|
||||||
mStream.reset()
|
mStream.reset()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,9 @@ object SQLParser {
|
|||||||
private const val STATE_COMMENT_BLOCK = 3
|
private const val STATE_COMMENT_BLOCK = 3
|
||||||
|
|
||||||
fun parse(stream: InputStream): List<String> {
|
fun parse(stream: InputStream): List<String> {
|
||||||
val buffer = BufferedInputStream(stream)
|
|
||||||
val commands: MutableList<String> = ArrayList()
|
val commands: MutableList<String> = ArrayList()
|
||||||
val sb = StringBuffer()
|
val sb = StringBuffer()
|
||||||
buffer.use { buffer ->
|
BufferedInputStream(stream).use { buffer ->
|
||||||
val tokenizer = Tokenizer(buffer)
|
val tokenizer = Tokenizer(buffer)
|
||||||
var state = STATE_NONE
|
var state = STATE_NONE
|
||||||
while (tokenizer.hasNext()) {
|
while (tokenizer.hasNext()) {
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ fun interface Task {
|
|||||||
fun onAttached(runner: TaskRunner) {}
|
fun onAttached(runner: TaskRunner) {}
|
||||||
fun onPostExecute() {}
|
fun onPostExecute() {}
|
||||||
fun onPreExecute() {}
|
fun onPreExecute() {}
|
||||||
fun onProgressUpdate(value: Int) {}
|
fun onProgressUpdate(currentPosition: Int) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class HabitListHeader(
|
|||||||
|
|
||||||
repeat(nButtons) { index ->
|
repeat(nButtons) { index ->
|
||||||
val date = today.minus(nButtons - index - 1)
|
val date = today.minus(nButtons - index - 1)
|
||||||
val name = fmt.shortWeekdayName(date).toUpperCase()
|
val name = fmt.shortWeekdayName(date).uppercase()
|
||||||
val number = date.day.toString()
|
val number = date.day.toString()
|
||||||
|
|
||||||
val x = width - (index + 1) * buttonSize + buttonSize / 2
|
val x = width - (index + 1) * buttonSize + buttonSize / 2
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
package org.isoron.platform.gui
|
package org.isoron.platform.gui
|
||||||
|
|
||||||
import junit.framework.Assert.fail
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.isoron.platform.io.JavaFileOpener
|
import org.isoron.platform.io.JavaFileOpener
|
||||||
|
import org.junit.Assert.fail
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
import java.awt.image.BufferedImage.TYPE_INT_ARGB
|
import java.awt.image.BufferedImage.TYPE_INT_ARGB
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.commands
|
package org.isoron.uhabits.core.commands
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.isoron.uhabits.core.models.Habit
|
import org.isoron.uhabits.core.models.Habit
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ArchiveHabitsCommandTest : BaseUnitTest() {
|
class ArchiveHabitsCommandTest : BaseUnitTest() {
|
||||||
private lateinit var command: ArchiveHabitsCommand
|
private lateinit var command: ArchiveHabitsCommand
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.commands
|
package org.isoron.uhabits.core.commands
|
||||||
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -27,6 +26,7 @@ import org.isoron.uhabits.core.models.Reminder
|
|||||||
import org.isoron.uhabits.core.models.WeekdayList
|
import org.isoron.uhabits.core.models.WeekdayList
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class CreateHabitCommandTest : BaseUnitTest() {
|
class CreateHabitCommandTest : BaseUnitTest() {
|
||||||
private lateinit var command: CreateHabitCommand
|
private lateinit var command: CreateHabitCommand
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.commands
|
package org.isoron.uhabits.core.commands
|
||||||
|
|
||||||
import junit.framework.Assert.assertEquals
|
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.isoron.uhabits.core.models.Entry
|
import org.isoron.uhabits.core.models.Entry
|
||||||
import org.isoron.uhabits.core.models.Habit
|
import org.isoron.uhabits.core.models.Habit
|
||||||
@@ -26,6 +25,7 @@ import org.isoron.uhabits.core.models.Timestamp
|
|||||||
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class CreateRepetitionCommandTest : BaseUnitTest() {
|
class CreateRepetitionCommandTest : BaseUnitTest() {
|
||||||
private lateinit var command: CreateRepetitionCommand
|
private lateinit var command: CreateRepetitionCommand
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.commands
|
package org.isoron.uhabits.core.commands
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.isoron.uhabits.core.models.Habit
|
import org.isoron.uhabits.core.models.Habit
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class UnarchiveHabitsCommandTest : BaseUnitTest() {
|
class UnarchiveHabitsCommandTest : BaseUnitTest() {
|
||||||
private lateinit var command: UnarchiveHabitsCommand
|
private lateinit var command: UnarchiveHabitsCommand
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.database
|
package org.isoron.uhabits.core.database
|
||||||
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder
|
import org.apache.commons.lang3.builder.EqualsBuilder
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder
|
import org.apache.commons.lang3.builder.HashCodeBuilder
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder
|
import org.apache.commons.lang3.builder.ToStringBuilder
|
||||||
@@ -27,6 +26,7 @@ import org.hamcrest.core.IsEqual.equalTo
|
|||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
class RepositoryTest : BaseUnitTest() {
|
class RepositoryTest : BaseUnitTest() {
|
||||||
private lateinit var repository: Repository<ThingRecord>
|
private lateinit var repository: Repository<ThingRecord>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.io
|
package org.isoron.uhabits.core.io
|
||||||
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -29,8 +28,9 @@ import java.io.File
|
|||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.LinkedList
|
import java.util.*
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class HabitsCSVExporterTest : BaseUnitTest() {
|
class HabitsCSVExporterTest : BaseUnitTest() {
|
||||||
private lateinit var baseDir: File
|
private lateinit var baseDir: File
|
||||||
@@ -102,9 +102,8 @@ class HabitsCSVExporterTest : BaseUnitTest() {
|
|||||||
private fun assertAbsolutePathExists(s: String) {
|
private fun assertAbsolutePathExists(s: String) {
|
||||||
val file = File(s)
|
val file = File(s)
|
||||||
assertTrue(
|
assertTrue(
|
||||||
String.format("File %s should exist", file.absolutePath),
|
String.format("File %s should exist", file.absolutePath)
|
||||||
file.exists()
|
) { file.exists() }
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertFileAndReferenceAreEqual(s: String) {
|
private fun assertFileAndReferenceAreEqual(s: String) {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.io
|
package org.isoron.uhabits.core.io
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.core.IsEqual.equalTo
|
import org.hamcrest.core.IsEqual.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -34,6 +32,8 @@ import org.junit.Before
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ImportTest : BaseUnitTest() {
|
class ImportTest : BaseUnitTest() {
|
||||||
@Before
|
@Before
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import junit.framework.Assert.assertEquals
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.CoreMatchers.not
|
import org.hamcrest.CoreMatchers.not
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
@@ -31,6 +28,9 @@ import org.junit.rules.ExpectedException
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
class HabitListTest : BaseUnitTest() {
|
class HabitListTest : BaseUnitTest() {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
|
|||||||
@@ -18,17 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers.`is`
|
import org.hamcrest.CoreMatchers.`is`
|
||||||
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.core.IsEqual.equalTo
|
import org.hamcrest.core.IsEqual.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
||||||
import org.junit.Assert.assertNotEquals
|
import org.junit.Assert.assertNotEquals
|
||||||
import org.junit.Assert.assertThat
|
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.rules.ExpectedException
|
import org.junit.rules.ExpectedException
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class HabitTest : BaseUnitTest() {
|
class HabitTest : BaseUnitTest() {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
@@ -55,7 +56,7 @@ class HabitTest : BaseUnitTest() {
|
|||||||
model.reminder = Reminder(8, 30, WeekdayList(1))
|
model.reminder = Reminder(8, 30, WeekdayList(1))
|
||||||
val habit = modelFactory.buildHabit()
|
val habit = modelFactory.buildHabit()
|
||||||
habit.copyFrom(model)
|
habit.copyFrom(model)
|
||||||
assertTrue(habit.isArchived == model.isArchived)
|
assertEquals(habit.isArchived, model.isArchived)
|
||||||
assertThat(habit.isArchived, `is`(model.isArchived))
|
assertThat(habit.isArchived, `is`(model.isArchived))
|
||||||
assertThat(habit.color, `is`(model.color))
|
assertThat(habit.color, `is`(model.color))
|
||||||
assertThat(habit.frequency, equalTo(model.frequency))
|
assertThat(habit.frequency, equalTo(model.frequency))
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.number.IsCloseTo
|
import org.hamcrest.number.IsCloseTo
|
||||||
import org.hamcrest.number.OrderingComparison
|
import org.hamcrest.number.OrderingComparison
|
||||||
@@ -28,6 +27,7 @@ import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
|||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
open class BaseScoreListTest : BaseUnitTest() {
|
open class BaseScoreListTest : BaseUnitTest() {
|
||||||
protected lateinit var habit: Habit
|
protected lateinit var habit: Habit
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.Matchers.equalTo
|
import org.hamcrest.Matchers.equalTo
|
||||||
import org.hamcrest.Matchers.greaterThan
|
import org.hamcrest.Matchers.greaterThan
|
||||||
@@ -27,6 +25,8 @@ import org.hamcrest.Matchers.lessThan
|
|||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
import org.isoron.uhabits.core.utils.DateUtils.Companion.getToday
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class TimestampTest : BaseUnitTest() {
|
class TimestampTest : BaseUnitTest() {
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models
|
package org.isoron.uhabits.core.models
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class WeekdayListTest : BaseUnitTest() {
|
class WeekdayListTest : BaseUnitTest() {
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.core.models.sqlite
|
package org.isoron.uhabits.core.models.sqlite
|
||||||
|
|
||||||
import junit.framework.Assert.assertEquals
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import org.isoron.uhabits.core.BaseUnitTest.Companion.buildMemoryDatabase
|
import org.isoron.uhabits.core.BaseUnitTest.Companion.buildMemoryDatabase
|
||||||
import org.isoron.uhabits.core.database.Repository
|
import org.isoron.uhabits.core.database.Repository
|
||||||
import org.isoron.uhabits.core.models.Entry
|
import org.isoron.uhabits.core.models.Entry
|
||||||
@@ -30,6 +28,8 @@ import org.isoron.uhabits.core.models.sqlite.records.EntryRecord
|
|||||||
import org.isoron.uhabits.core.utils.DateUtils
|
import org.isoron.uhabits.core.utils.DateUtils
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
class SQLiteEntryListTest {
|
class SQLiteEntryListTest {
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.models.sqlite
|
package org.isoron.uhabits.core.models.sqlite
|
||||||
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -38,6 +37,7 @@ import org.junit.rules.ExpectedException
|
|||||||
import org.mockito.kotlin.mock
|
import org.mockito.kotlin.mock
|
||||||
import org.mockito.kotlin.verify
|
import org.mockito.kotlin.verify
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
class SQLiteHabitListTest : BaseUnitTest() {
|
class SQLiteHabitListTest : BaseUnitTest() {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.preferences
|
package org.isoron.uhabits.core.preferences
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -31,6 +28,9 @@ import org.junit.Before
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mockito.kotlin.mock
|
import org.mockito.kotlin.mock
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class PreferencesTest : BaseUnitTest() {
|
class PreferencesTest : BaseUnitTest() {
|
||||||
private lateinit var prefs: Preferences
|
private lateinit var prefs: Preferences
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.preferences
|
package org.isoron.uhabits.core.preferences
|
||||||
|
|
||||||
import junit.framework.Assert.assertEquals
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.CoreMatchers.equalTo
|
import org.hamcrest.CoreMatchers.equalTo
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -28,6 +25,9 @@ import org.junit.Before
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Arrays
|
import java.util.Arrays
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class PropertiesStorageTest : BaseUnitTest() {
|
class PropertiesStorageTest : BaseUnitTest() {
|
||||||
private lateinit var storage: PropertiesStorage
|
private lateinit var storage: PropertiesStorage
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.ui.screens.habits.list
|
package org.isoron.uhabits.core.ui.screens.habits.list
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.Matchers.equalTo
|
import org.hamcrest.Matchers.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -31,6 +28,9 @@ import org.junit.Test
|
|||||||
import org.mockito.kotlin.mock
|
import org.mockito.kotlin.mock
|
||||||
import org.mockito.kotlin.verify
|
import org.mockito.kotlin.verify
|
||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class HintListTest : BaseUnitTest() {
|
class HintListTest : BaseUnitTest() {
|
||||||
private lateinit var hintList: HintList
|
private lateinit var hintList: HintList
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.ui.screens.habits.list
|
package org.isoron.uhabits.core.ui.screens.habits.list
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.apache.commons.io.FileUtils
|
import org.apache.commons.io.FileUtils
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.core.IsEqual.equalTo
|
import org.hamcrest.core.IsEqual.equalTo
|
||||||
@@ -41,6 +39,8 @@ import org.mockito.kotlin.verify
|
|||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ListHabitsBehaviorTest : BaseUnitTest() {
|
class ListHabitsBehaviorTest : BaseUnitTest() {
|
||||||
private val dirFinder: ListHabitsBehavior.DirFinder = mock()
|
private val dirFinder: ListHabitsBehavior.DirFinder = mock()
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.ui.screens.habits.list
|
package org.isoron.uhabits.core.ui.screens.habits.list
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.Matchers.equalTo
|
import org.hamcrest.Matchers.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -37,6 +35,8 @@ import org.mockito.kotlin.never
|
|||||||
import org.mockito.kotlin.verify
|
import org.mockito.kotlin.verify
|
||||||
import org.mockito.kotlin.verifyNoMoreInteractions
|
import org.mockito.kotlin.verifyNoMoreInteractions
|
||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ListHabitsMenuBehaviorTest : BaseUnitTest() {
|
class ListHabitsMenuBehaviorTest : BaseUnitTest() {
|
||||||
private lateinit var behavior: ListHabitsMenuBehavior
|
private lateinit var behavior: ListHabitsMenuBehavior
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.ui.screens.habits.list
|
package org.isoron.uhabits.core.ui.screens.habits.list
|
||||||
|
|
||||||
import junit.framework.Assert.assertFalse
|
|
||||||
import junit.framework.Assert.assertNull
|
|
||||||
import junit.framework.Assert.assertTrue
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.Matchers.equalTo
|
import org.hamcrest.Matchers.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -35,6 +32,9 @@ import org.mockito.kotlin.eq
|
|||||||
import org.mockito.kotlin.mock
|
import org.mockito.kotlin.mock
|
||||||
import org.mockito.kotlin.verify
|
import org.mockito.kotlin.verify
|
||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ListHabitsSelectionMenuBehaviorTest : BaseUnitTest() {
|
class ListHabitsSelectionMenuBehaviorTest : BaseUnitTest() {
|
||||||
private val screen: ListHabitsSelectionMenuBehavior.Screen = mock()
|
private val screen: ListHabitsSelectionMenuBehavior.Screen = mock()
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.core.utils
|
package org.isoron.uhabits.core.utils
|
||||||
|
|
||||||
import junit.framework.Assert.assertEquals
|
|
||||||
import org.hamcrest.MatcherAssert.assertThat
|
import org.hamcrest.MatcherAssert.assertThat
|
||||||
import org.hamcrest.core.IsEqual.equalTo
|
import org.hamcrest.core.IsEqual.equalTo
|
||||||
import org.isoron.uhabits.core.BaseUnitTest
|
import org.isoron.uhabits.core.BaseUnitTest
|
||||||
@@ -40,6 +39,7 @@ import java.util.Calendar
|
|||||||
import java.util.GregorianCalendar
|
import java.util.GregorianCalendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class DateUtilsTest : BaseUnitTest() {
|
class DateUtilsTest : BaseUnitTest() {
|
||||||
var firstWeekday = Calendar.SUNDAY
|
var firstWeekday = Calendar.SUNDAY
|
||||||
|
|||||||
Reference in New Issue
Block a user