|
|
|
@ -9,8 +9,8 @@ import com.todoroo.astrid.data.RemoteModel;
|
|
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
import static junit.framework.Assert.assertEquals;
|
|
|
|
|
import static junit.framework.Assert.fail;
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
|
public class RemoteModelHelpers {
|
|
|
|
@ -18,7 +18,7 @@ public class RemoteModelHelpers {
|
|
|
|
|
Set<String> keys = contentValues.keySet();
|
|
|
|
|
Property[] result = new Property[keys.size()];
|
|
|
|
|
int index = 0;
|
|
|
|
|
for(String key : keys) {
|
|
|
|
|
for (String key : keys) {
|
|
|
|
|
result[index++] = new Property.StringProperty(table, key);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
@ -30,19 +30,19 @@ public class RemoteModelHelpers {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void compareContentValues(ContentValues expected, ContentValues actual) {
|
|
|
|
|
if(expected == null && actual == null) {
|
|
|
|
|
if (expected == null && actual == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(expected == null || actual == null) {
|
|
|
|
|
if (expected == null || actual == null) {
|
|
|
|
|
fail();
|
|
|
|
|
}
|
|
|
|
|
for(String key : expected.keySet()) {
|
|
|
|
|
for (String key : expected.keySet()) {
|
|
|
|
|
Object entry = expected.get(key);
|
|
|
|
|
if(entry instanceof Integer) {
|
|
|
|
|
if (entry instanceof Integer) {
|
|
|
|
|
assertEquals(entry, actual.getAsInteger(key));
|
|
|
|
|
} else if(entry instanceof String) {
|
|
|
|
|
} else if (entry instanceof String) {
|
|
|
|
|
assertEquals(entry, actual.getAsString(key));
|
|
|
|
|
} else if(entry instanceof Long) {
|
|
|
|
|
} else if (entry instanceof Long) {
|
|
|
|
|
assertEquals(entry, actual.getAsLong(key));
|
|
|
|
|
} else {
|
|
|
|
|
fail("Unhandled property type: " + entry.getClass());
|
|
|
|
|