mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
cleanup: tweak assertions
This commit is contained in:
parent
e30fd7151f
commit
ce743a7e11
2 changed files with 9 additions and 5 deletions
|
@ -639,6 +639,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
public static int update( SQLiteDatabase db, TABLE_NAMES table, ContentValues values,
|
||||
String selection )
|
||||
{
|
||||
// returns number of rows impacted
|
||||
return db.update( table.toString(), values, selection, null );
|
||||
}
|
||||
|
||||
|
|
|
@ -1943,8 +1943,11 @@ public class DBUtils {
|
|||
cursor.close();
|
||||
}
|
||||
|
||||
if ( null != result && null == result.fullSum ) { // force generation
|
||||
result = null;
|
||||
if ( null != result ) {
|
||||
Assert.assertTrueNR( !TextUtils.isEmpty(result.isoCode ) );
|
||||
if ( null == result.fullSum ) { // force generation
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1953,12 +1956,12 @@ public class DBUtils {
|
|||
public static void dictsSetInfo( Context context, DictUtils.DictAndLoc dal,
|
||||
DictInfo info )
|
||||
{
|
||||
Assert.assertTrueNR( ! TextUtils.isEmpty( info.isoCode ) );
|
||||
|
||||
String selection =
|
||||
String.format( NAME_FMT, DBHelper.DICTNAME, dal.name );
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
Assert.assertTrueNR( null != info.isoCode && ! info.isoCode.equals("null") );
|
||||
|
||||
values.put( DBHelper.ISOCODE, info.isoCode );
|
||||
values.put( DBHelper.LANGNAME, info.langName );
|
||||
values.put( DBHelper.WORDCOUNT, info.wordCount );
|
||||
|
@ -1972,7 +1975,7 @@ public class DBUtils {
|
|||
if ( 0 == result ) {
|
||||
values.put( DBHelper.DICTNAME, dal.name );
|
||||
long rowid = insert( TABLE_NAMES.DICTINFO, values );
|
||||
Assert.assertTrue( rowid > 0 || !BuildConfig.DEBUG );
|
||||
Assert.assertTrueNR( 0 < rowid );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue