@Test
public void testToMultimap() {

    Observable<String> source = Observable.from("a", "b", "cc", "dd");
    Observable<Map<Integer, Collection<String>>> mapped = Observable.create(OperationToMultimap.toMultimap(source, lengthFunc));
    Map<Integer, Collection<String>> expected = new HashMap<Integer, Collection<String>>();
    expected.put(1, Arrays.asList("a", "b"));
    expected.put(2, Arrays.asList("cc", "dd"));
    mapped.subscribe(objectObserver);
    verify(objectObserver, never()).onError(any(Throwable.class));
    verify(objectObserver, times(1)).onNext(expected);
    verify(objectObserver, times(1)).onCompleted();
}