Java Code Examples for android.database.SQLException.getMessage()

The following are Jave code examples for showing how to use getMessage() of the android.database.SQLException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File:   Source Code and License Vote up 6 votes
 * Should try to use the legacy parser by default, which is be unable to handle the SQL script.
public void testLegacyMigration() {

    try {
        Configuration configuration = new Configuration.Builder(getContext())

        DatabaseHelper helper = new DatabaseHelper(configuration);
        SQLiteDatabase db = helper.getWritableDatabase();
        helper.onUpgrade(db, 1, 2);

        fail("Should not be able to parse the SQL script.");

    } catch (SQLException e) {
        final String message = e.getMessage();

        assertTrue(message.contains("syntax error"));
        assertTrue(message.contains("near \"MockMigration\""));