Skip to content

Commit

Permalink
Migrate one exceptional test
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqua committed Jul 25, 2023
1 parent 9fc086d commit 001a2b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions uhabits-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ kotlin {
implementation("org.hamcrest:hamcrest:2.2")
implementation("org.apache.commons:commons-io:1.3.2")
implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
implementation("org.junit.jupiter:junit-jupiter:5.8.1")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.isoron.uhabits.core.models.sqlite.SQLModelFactory
import org.isoron.uhabits.core.test.HabitFixtures
import org.junit.Rule
import org.junit.Test
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.rules.ExpectedException

class Version22Test : BaseUnitTest() {
Expand Down Expand Up @@ -76,8 +77,8 @@ class Version22Test : BaseUnitTest() {
@Throws(Exception::class)
fun testDisallowNewRepsWithInvalidRef() {
helper.migrateTo(22)
exception.expectMessage(Matchers.containsString("SQLITE_CONSTRAINT"))
db.execute("insert into Repetitions(habit, timestamp, value) values (99999, 100, 2)")
val exc = assertThrows(java.lang.RuntimeException::class.java) { db.execute("insert into Repetitions(habit, timestamp, value) values (99999, 100, 2)") }
assertThat(exc.message, Matchers.containsString("SQLITE_CONSTRAINT"))
}

@Test
Expand Down

0 comments on commit 001a2b7

Please sign in to comment.