Example #1
0
  @Test
  public void getFirstSelectedItem_should_return_null_when_no_items_selected() throws Exception {
    when(navigatorItems.getSelectedItems()).thenReturn(Collections.<SortNavigatorItem>emptyList());

    SortNavigatorItem actual = sortNavigator.getFirstSelectedItem();

    assertThat(actual, is(nullValue()));
  }
Example #2
0
  @Test
  public void getFirstSelectedItem_should_return_first_selected_item() throws Exception {
    SortNavigatorItem expected = Mockito.mock(SortNavigatorItem.class);
    when(navigatorItems.getSelectedItems()).thenReturn(Arrays.asList(expected));

    SortNavigatorItem actual = sortNavigator.getFirstSelectedItem();

    assertThat(actual, is(sameInstance(expected)));
  }