Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robolectric and OrmLite inconsistency with uppercase column name #1017

Closed
ntsik opened this issue Mar 25, 2014 · 1 comment
Closed

Robolectric and OrmLite inconsistency with uppercase column name #1017

ntsik opened this issue Mar 25, 2014 · 1 comment

Comments

@ntsik
Copy link

ntsik commented Mar 25, 2014

Using Robolectric 2.2 and OrmLite 4.47

The database my app uses has an uppercase column name for one of its tables, declared as such by OrmLite:

@DatabaseField(columnName="COLUMN_NAME", dataType=DataType.BYTE_ARRAY)
private byte[] column;

Everything works fine in the app. However, when using Robolectric, any test fails when trying to query for an item from the table (queryForId, for instance) with this uppercase column name, resulting from this SQLException:

java.sql.SQLException: Unknown field 'COLUMN_NAME' from the Android sqlite cursor, not in:[column_name]
(rest of columns omitted)

OrmLite seems to be case sensitive in regards to column names, whereas Robolectric seems to use lowercase column names.

If I change the OrmLite code to lowercase, i.e.

@DatabaseField(columnName="column_name", dataType=DataType.BYTE_ARRAY)
private byte[] column;

the Robolectric tests will pass, though the app will crash with:

java.sql.SQLException: Unknown field 'column_name' from the Android sqlite cursor, not in:[COLUMN_NAME]
(rest of columns omitted)
@ntsik
Copy link
Author

ntsik commented May 14, 2014

Just tried Robolectric 2.3-SNAPSHOT, and this doesn't seem to be an issue anymore.

@ntsik ntsik closed this as completed May 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant