File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
sqlcipher/src/androidTest/java/net/zetetic/database/sqlcipher_cts Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ package net .zetetic .database .sqlcipher_cts ;
2+
3+ import static org .hamcrest .Matchers .is ;
4+ import static org .junit .Assert .assertThat ;
5+
6+ import android .database .Cursor ;
7+
8+ import org .junit .Test ;
9+
10+ public class JsonCastTest extends AndroidSQLCipherTestCase {
11+
12+ @ Test
13+ public void shouldExtractUsernameFromQuery (){
14+ String name = "Bob Smith" , queryName = "" ;
15+ String query = String .format ("select cast(json_extract('{\" user\" :\" %s\" }','$.user') as TEXT);" , name );
16+ Cursor cursor = database .rawQuery (query );
17+ if (cursor != null && cursor .moveToFirst ()){
18+ queryName = cursor .getString (0 );
19+ cursor .close ();
20+ }
21+ assertThat (queryName , is (name ));
22+ }
23+
24+ }
You can’t perform that action at this time.
0 commit comments