Skip to content

Commit feab134

Browse files
mikehardydavid-allison
authored andcommitted
Revert "test: Android 36+ emulators built-in sqlite responds w/new exception"
Partial revert of commit 1cf9883. API36 emulators no longer need special handling, they have reverted to the original exception
1 parent 37f3457 commit feab134

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/database/CorruptDiskFullDatabaseTest.kt

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package net.ankiweb.rsdroid.database
1717

18-
import android.database.sqlite.SQLiteDiskIOException
1918
import android.database.sqlite.SQLiteFullException
20-
import android.os.Build
2119
import net.ankiweb.rsdroid.database.testutils.DatabaseCorruption
2220
import net.ankiweb.rsdroid.exceptions.BackendJsonException
2321
import org.hamcrest.MatcherAssert
@@ -44,35 +42,19 @@ class CorruptDiskFullDatabaseTest : DatabaseCorruption() {
4442
)
4543
}
4644
DatabaseType.FRAMEWORK -> {
47-
// FRAMEWORK still complains about disk full corruption for API < 36:
45+
// FRAMEWORK still complains about disk full corruption:
4846
// error while compiling: "create table nums (id int)": DBError { info: "SqliteFailure(Error { code: DiskFull, extended_code: 13 }, Some(\"database or disk is full\"))", kind: Other }
49-
if (Build.VERSION.SDK_INT_FULL < Build.VERSION_CODES_FULL.BAKLAVA) {
50-
MatcherAssert.assertThat(
51-
setupException.javaClass,
52-
Matchers.typeCompatibleWith(
53-
SQLiteFullException::class.java,
54-
),
55-
)
56-
// Java: "database or disk is full (code 13)"
57-
MatcherAssert.assertThat(
58-
setupException.localizedMessage,
59-
Matchers.containsString("database or disk is full"),
60-
)
61-
// On API >= 36 we get a disk I/O exception
62-
} else {
63-
MatcherAssert.assertThat(
64-
setupException.javaClass,
65-
Matchers.typeCompatibleWith(
66-
SQLiteDiskIOException::class.java,
67-
),
68-
)
69-
70-
// Java: "database or disk is full (code 13)"
71-
MatcherAssert.assertThat(
72-
setupException.localizedMessage,
73-
Matchers.containsString("disk I/O error"),
74-
)
75-
}
47+
MatcherAssert.assertThat(
48+
setupException.javaClass,
49+
Matchers.typeCompatibleWith(
50+
SQLiteFullException::class.java,
51+
),
52+
)
53+
// Java: "database or disk is full (code 13)"
54+
MatcherAssert.assertThat(
55+
setupException.localizedMessage,
56+
Matchers.containsString("database or disk is full"),
57+
)
7658
}
7759
else -> null
7860
}

0 commit comments

Comments
 (0)