@Test public void constructWithNullAsItems() { Throwable actual = thrownBy( () -> new Memento<>( null, Optional.empty() ) ); assertThat( actual ) .hasMessage( ARGUMENT_ITEMS_MUST_NOT_BE_NULL ) .isInstanceOf( IllegalArgumentException.class ); }
@SuppressWarnings( "unchecked" ) public static <T extends Item> Memento<T> empty() { return ( Memento<T> )EMPTY_MEMENTO; }
Memento { @SuppressWarnings( "unchecked" ) public static <T extends Item> Memento<T> empty() { return ( Memento<T> )EMPTY_MEMENTO; } }
Memento { @SuppressWarnings( "unchecked" ) public static <T extends Item> Memento<T> empty() { return ( Memento<T> )EMPTY_MEMENTO; } Memento( Set<T> items, Optional<T> topItem ); }
Memento { @SuppressWarnings( "unchecked" ) public static <T extends Item> Memento<T> empty() { return ( Memento<T> )EMPTY_MEMENTO; } Memento( Set<T> items, Optional<T> topItem ); @SuppressWarnings( "unchecked" ) static Memento<T> empty(); Set<T> getItems(); Optional<T> getTopItem(); }
Memento { @SuppressWarnings( "unchecked" ) public static <T extends Item> Memento<T> empty() { return ( Memento<T> )EMPTY_MEMENTO; } Memento( Set<T> items, Optional<T> topItem ); @SuppressWarnings( "unchecked" ) static Memento<T> empty(); Set<T> getItems(); Optional<T> getTopItem();  }