Java Code Examples for org.threeten.bp.LocalDateTime#plusMinutes()

The following examples show how to use org.threeten.bp.LocalDateTime#plusMinutes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectedSessionsMemoryTest.java    From droidconat-2016 with Apache License 2.0 6 votes vote down vote up
@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));

    // When
    assertThat(memory.get(now)).isEqualTo(1);
    memory.toggleSessionState(toAdd, true);

    // Then
    assertThat(memory.get(now)).isEqualTo(3);
}
 
Example 2
Source File: SessionTest.java    From droidconat-2016 with Apache License 2.0 6 votes vote down vote up
@Test
public void should_restore_from_parcelable() {
    // Given
    List<Speaker> speakers = singletonList(new Speaker(1, null, null, null, null, null, null, null));
    LocalDateTime fromTime = LocalDateTime.now().minusDays(1);
    LocalDateTime toTime = fromTime.plusMinutes(45);
    Session session = new Session(42, "ROOM1", speakers, "TITLE", "DESCRIPTION", fromTime, toTime);

    // When
    Parcel parcel = Parcel.obtain();
    session.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    Session fromParcel = Session.CREATOR.createFromParcel(parcel);

    // Then
    assertThat(fromParcel.getId()).isEqualTo(42);
    assertThat(fromParcel.getRoom()).isEqualTo("ROOM1");
    assertThat(fromParcel.getSpeakers()).hasSize(1);
    assertThat(fromParcel.getTitle()).isEqualTo("TITLE");
    assertThat(fromParcel.getDescription()).isEqualTo("DESCRIPTION");
    assertThat(fromParcel.getFromTime()).isEqualTo(fromTime);
    assertThat(fromParcel.getToTime()).isEqualTo(toTime);
}