// Path: app/src/main/java/com/nilhcem/droidconde/data/app/model/Session.java
// @Value
// public class Session implements Parcelable {
// 
//     public static final Parcelable.Creator<Session> CREATOR = new Parcelable.Creator<Session>() {
//         public Session createFromParcel(Parcel source) {
//             return new Session(source);
//         }
// 
//         public Session[] newArray(int size) {
//             return new Session[size];
//         }
//     };
// 
//     int id;
//     String room;
//     List<Speaker> speakers;
//     String title;
//     String description;
//     LocalDateTime fromTime;
//     LocalDateTime toTime;
// 
//     public Session(int id, String room, List<Speaker> speakers, String title, String description, LocalDateTime fromTime, LocalDateTime toTime) {
//         this.id = id;
//         this.room = room;
//         this.speakers = speakers;
//         this.title = title;
//         this.description = description;
//         this.fromTime = fromTime;
//         this.toTime = toTime;
//     }
// 
//     protected Session(Parcel in) {
//         id = in.readInt();
//         room = in.readString();
//         speakers = in.createTypedArrayList(Speaker.CREATOR);
//         title = in.readString();
//         description = in.readString();
//         fromTime = (LocalDateTime) in.readSerializable();
//         toTime = (LocalDateTime) in.readSerializable();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(id);
//         dest.writeString(room);
//         dest.writeTypedList(speakers);
//         dest.writeString(title);
//         dest.writeString(description);
//         dest.writeSerializable(fromTime);
//         dest.writeSerializable(toTime);
//     }
// }


import android.os.Build;
import com.nilhcem.droidconde.BuildConfig;
import com.nilhcem.droidconde.data.app.model.Session;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import org.threeten.bp.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.truth.Truth.assertThat;
package com.nilhcem.droidconde.data.app;






@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
public class SelectedSessionsMemoryTest {

    private final SelectedSessionsMemory memory = new SelectedSessionsMemory();

    @Test
    public void should_set_selected_sessions() {
        // Given
        LocalDateTime now = LocalDateTime.now();
        Map<LocalDateTime, Integer> map = new HashMap<>();
        map.put(now, 1);

        // When
        assertThat(memory.get(now)).isNull();
        memory.setSelectedSessions(map);

        // Then
        assertThat(memory.get(now)).isEqualTo(1);
    }

    @Test
    public void should_remove_previous_session_when_adding_a_new_one_for_the_same_slot_time() {
        // Given
        LocalDateTime now = LocalDateTime.now();
        Map<LocalDateTime, Integer> map = new HashMap<>();
        map.put(now, 1);
        memory.setSelectedSessions(map);
// Path: app/src/main/java/com/nilhcem/droidconde/data/app/model/Session.java
// @Value
// public class Session implements Parcelable {
// 
//     public static final Parcelable.Creator<Session> CREATOR = new Parcelable.Creator<Session>() {
//         public Session createFromParcel(Parcel source) {
//             return new Session(source);
//         }
// 
//         public Session[] newArray(int size) {
//             return new Session[size];
//         }
//     };
// 
//     int id;
//     String room;
//     List<Speaker> speakers;
//     String title;
//     String description;
//     LocalDateTime fromTime;
//     LocalDateTime toTime;
// 
//     public Session(int id, String room, List<Speaker> speakers, String title, String description, LocalDateTime fromTime, LocalDateTime toTime) {
//         this.id = id;
//         this.room = room;
//         this.speakers = speakers;
//         this.title = title;
//         this.description = description;
//         this.fromTime = fromTime;
//         this.toTime = toTime;
//     }
// 
//     protected Session(Parcel in) {
//         id = in.readInt();
//         room = in.readString();
//         speakers = in.createTypedArrayList(Speaker.CREATOR);
//         title = in.readString();
//         description = in.readString();
//         fromTime = (LocalDateTime) in.readSerializable();
//         toTime = (LocalDateTime) in.readSerializable();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(id);
//         dest.writeString(room);
//         dest.writeTypedList(speakers);
//         dest.writeString(title);
//         dest.writeString(description);
//         dest.writeSerializable(fromTime);
//         dest.writeSerializable(toTime);
//     }
// }


// Path: app/src/test/java/com/nilhcem/droidconde/data/app/SelectedSessionsMemoryTest.java
import android.os.Build;
import com.nilhcem.droidconde.BuildConfig;
import com.nilhcem.droidconde.data.app.model.Session;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import org.threeten.bp.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.truth.Truth.assertThat;

package com.nilhcem.droidconde.data.app;






@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
public class SelectedSessionsMemoryTest {

    private final SelectedSessionsMemory memory = new SelectedSessionsMemory();

    @Test
    public void should_set_selected_sessions() {
        // Given
        LocalDateTime now = LocalDateTime.now();
        Map<LocalDateTime, Integer> map = new HashMap<>();
        map.put(now, 1);

        // When
        assertThat(memory.get(now)).isNull();
        memory.setSelectedSessions(map);

        // Then
        assertThat(memory.get(now)).isEqualTo(1);
    }

    @Test
    public void should_remove_previous_session_when_adding_a_new_one_for_the_same_slot_time() {
        // Given
        LocalDateTime now = LocalDateTime.now();
        Map<LocalDateTime, Integer> map = new HashMap<>();
        map.put(now, 1);
        memory.setSelectedSessions(map);
        Session toAdd = new Session(3, null, null, null, null, now, now.plusMinutes(30));