Skip to content

Commit 4871b75

Browse files
Extending the rekey test to verify content is available following rekey
1 parent c532a0d commit 4871b75

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/net/zetetic/tests/RawRekeyTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.zetetic.tests;
22

33
import net.sqlcipher.database.SQLiteDatabase;
4+
import net.zetetic.QueryHelper;
45
import net.zetetic.ZeteticApplication;
56

67
import java.io.File;
@@ -13,10 +14,15 @@ public class RawRekeyTest extends SQLCipherTest {
1314

1415
@Override
1516
public boolean execute(SQLiteDatabase database) {
17+
database.execSQL("create table t1(a,b);");
18+
database.execSQL("insert into t1(a,b) values(?,?)", new Object[]{"one for the money", "two for the show"});
1619
database.rawExecSQL(rekeyCommand);
1720
database.close();
1821
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, password, null);
19-
return database != null;
22+
int count = QueryHelper.singleIntegerValueFromQuery(database, "select count(*) from t1;");
23+
boolean status = count == 1;
24+
database.close();
25+
return status;
2026
}
2127

2228
@Override

0 commit comments

Comments
 (0)