ItemUiMap { public ItemUi<T> findByItemId( String id ) { checkArgument( id != null, ID_MUST_NOT_BE_NULL ); checkArgument( containsItemUi( id ), UNKNOWN_ITEM_UI_ENTRY, id ); return itemUis.get( id ); } ItemUiMap( Timeline<T> timeline, ItemUiFactory<T, U> itemUiFactory ); boolean containsItemUi( String id ); ItemUi<T> findByItemId( String id ); boolean isTimelineEmpty(); void fetch( FetchOperation operation ); void update( U uiContext );  }
@Test public void findByItemId() { itemUiMap.update( uiContext ); ItemUi<FakeItem> actual = itemUiMap.findByItemId( item.getId() ); assertThat( actual ).isSameAs( itemUi ); }
@Test public void findByItemIdForUnknownItem() { Throwable actual = thrownBy( () -> itemUiMap.findByItemId( item.getId() ) ); assertThat( actual ) .hasMessageContaining( item.getId() ) .isInstanceOf( IllegalArgumentException.class ); }
@Test public void findByItemIdWithNullAsId() { Throwable actual = thrownBy( () -> itemUiMap.findByItemId( null ) ); assertThat( actual ) .hasMessageContaining( ID_MUST_NOT_BE_NULL ) .isInstanceOf( IllegalArgumentException.class ); }