Speaker { public static ContentValues createContentValues(Speaker speaker) { ContentValues values = new ContentValues(); values.put(ID, speaker.id); values.put(NAME, speaker.name); values.put(TITLE, speaker.title); values.put(BIO, speaker.bio); values.put(WEBSITE, speaker.website); values.put(TWITTER, speaker.twitter); values.put(GITHUB, speaker.github); values.put(PHOTO, speaker.photo); return values; } Speaker(int id, String name, String title, String bio, String website, String twitter, String github, String photo); static ContentValues createContentValues(Speaker speaker); static final String TABLE; static final String ID; static final String NAME; static final String TITLE; static final String BIO; static final String WEBSITE; static final String TWITTER; static final String GITHUB; static final String PHOTO; final int id; final String name; final String title; final String bio; final String website; final String twitter; final String github; final String photo; static final Func1<Cursor, Speaker> MAPPER; }
@Test public void should_create_content_values_for_sqlite() { Speaker speaker = new Speaker(3, "name", "title", "bio", "website", "twitter", "github", "photo"); ContentValues result = Speaker.createContentValues(speaker); assertThat(result.get("_id")).isEqualTo(3); assertThat(result.get("name")).isEqualTo("name"); assertThat(result.get("title")).isEqualTo("title"); assertThat(result.get("bio")).isEqualTo("bio"); assertThat(result.get("website")).isEqualTo("website"); assertThat(result.get("twitter")).isEqualTo("twitter"); assertThat(result.get("github")).isEqualTo("github"); assertThat(result.get("photo")).isEqualTo("photo"); }