### Question:
ContentProviderStoreCoreBase { @NonNull protected <R> Observable<List<R>> groupOperations(@NonNull final Observable<R> source) { return source.publish(stream -> stream.buffer( Observable.merge( stream.window(groupMaxSize).skip(1), stream.debounce(groupingTimeout, TimeUnit.MILLISECONDS)))) .filter(list -> !list.isEmpty()); } protected  ContentProviderStoreCoreBase(@NonNull final ContentResolver contentResolver); protected  ContentProviderStoreCoreBase(@NonNull final ContentResolver contentResolver,
                                           final int groupingTimeout,
                                           final int groupMaxSize); @NonNull static Handler createHandler(@NonNull final String name);  }### Answer:
@Test public void groupOperations_WithNoElements_DoesNotEmit() { contentStoreCore.<Integer>groupOperations(Observable.never()) .test() .awaitDone(2 * DEFAULT_GROUPING_TIMEOUT_MS, TimeUnit.MILLISECONDS) .assertNotComplete() .assertNoValues(); }
@Test public void groupOperations_WithOneElement_EmitsOneGroup() { contentStoreCore.groupOperations(createSource(1)) .test() .awaitDone(2 * DEFAULT_GROUPING_TIMEOUT_MS, TimeUnit.MILLISECONDS) .assertNotComplete() .assertValueCount(1); }
@Test public void groupOperations_WithGroupMaxSizeElements_EmitsOneGroup() { contentStoreCore.groupOperations(createSource(DEFAULT_GROUP_MAX_SIZE)) .test() .awaitDone(2 * DEFAULT_GROUPING_TIMEOUT_MS, TimeUnit.MILLISECONDS) .assertNotComplete() .assertValueCount(1); }
@Test public void groupOperations_WithOneOverGroupMaxSizeElements_EmitsTwoGroups() { contentStoreCore.groupOperations(createSource(DEFAULT_GROUP_MAX_SIZE + 1)) .test() .awaitDone(2 * DEFAULT_GROUPING_TIMEOUT_MS, TimeUnit.MILLISECONDS) .assertNotComplete() .assertValueCount(2); }
@Test public void groupOperations_WithThreeTimesGroupMaxSizeElements_EmitsThreeGroups() { contentStoreCore.groupOperations(createSource(3 * DEFAULT_GROUP_MAX_SIZE)) .test() .awaitDone(2 * DEFAULT_GROUPING_TIMEOUT_MS, TimeUnit.MILLISECONDS) .assertNotComplete() .assertValueCount(3); }