Session { public static ContentValues createContentValues(Session session) { ContentValues values = new ContentValues(); values.put(ID, session.id); values.put(START_AT, session.startAt); values.put(DURATION, session.duration); values.put(ROOM_ID, session.roomId); values.put(SPEAKERS_IDS, session.speakersIds); values.put(TITLE, session.title); values.put(DESCRIPTION, session.description); return values; } Session(int id, String startAt, int duration, int roomId, String speakersIds, String title, String description); static ContentValues createContentValues(Session session); static final String TABLE; static final String ID; static final String START_AT; static final String DURATION; static final String ROOM_ID; static final String SPEAKERS_IDS; static final String TITLE; static final String DESCRIPTION; final int id; final String startAt; final int duration; final int roomId; final String speakersIds; final String title; final String description; static final Func1<Cursor, Session> MAPPER; }
@Test public void should_create_content_values_for_sqlite() { Session session = new Session(10, "startAt", 45, 3, "[3, 4]", "title", "description"); ContentValues result = Session.createContentValues(session); assertThat(result.get("_id")).isEqualTo(10); assertThat(result.get("start_at")).isEqualTo("startAt"); assertThat(result.get("duration")).isEqualTo(45); assertThat(result.get("room_id")).isEqualTo(3); assertThat(result.get("speakers_ids")).isEqualTo("[3, 4]"); assertThat(result.get("title")).isEqualTo("title"); assertThat(result.get("description")).isEqualTo("description"); }