@Test
public void closeReleasesBufferOnlyOnce() throws IOException {

    // given
    ItemSource itemSource = mock(ItemSource.class);
    when(itemSource.getSource()).thenReturn(mock(SimpleInputBuffer.class));
    InputStream inputStream = new ItemSourceContentInputStream(itemSource);
    // when
    inputStream.close();
    inputStream.close();
    // then
    verify(itemSource, times(1)).release();
}