@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())); }
@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))); }