StreamList { public void add( T item ) { onAdd.onNext( item ); } StreamList(); void add( T item ); PublishSubject<T> getStream();  }
@Test public void testAdd() { streamList.getStream().buffer( 1 ).subscribe( list -> resultList = list ); streamList.add( MOCK_MESSAGE ); assertEquals( 1, resultList.size() ); assertEquals( MOCK_MESSAGE, resultList.get( 0 ) ); }