GitItemSerialization implements ItemSerialization<GitItem> { @Override public String serialize( GitItem item ) { checkArgument( item != null, ITEM_MUST_NOT_BE_NULL ); return new StringBuilder() .append( item.getId() ).append( SEPARATOR ) .append( item.getTimeStamp() ).append( SEPARATOR ) .append( item.getAuthor() ).append( SEPARATOR ) .append( item.getContent() ).toString(); }  @Override String serialize( GitItem item ); @Override GitItem deserialize( String input );  }
@Test public void serializeWithNullAsItem() { Throwable actual = thrownBy( () -> serialization.serialize( null ) ); assertThat( actual ) .hasMessage( ITEM_MUST_NOT_BE_NULL ) .isInstanceOf( IllegalArgumentException.class ); }