### Question:
MultiTakeWhilePublisher implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); } MultiTakeWhilePublisher(Multi<T> source, Predicate<? super T> predicate); @Override void subscribe(Flow.Subscriber<? super T> subscriber);  }### Answer:
@Test public void error() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>error(new IOException()) .takeWhile(v -> true) .subscribe(ts); assertThat(ts.getItems().isEmpty(), is(true)); assertThat(ts.getLastError(), instanceOf(IOException.class)); assertThat(ts.isComplete(), is(false)); }
@Test public void limited() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.just(1, 2, 3, 4, 5) .takeWhile(v -> v < 4) .subscribe(ts); ts.requestMax(); assertEquals(ts.getItems(), Arrays.asList(1, 2, 3)); assertThat(ts.getLastError(), is(nullValue())); assertThat(ts.isComplete(), is(true)); }
@Test public void predicateCrash() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>singleton(1) .takeWhile(v -> { throw new IllegalArgumentException();}) .subscribe(ts); ts.requestMax(); assertThat(ts.getItems().isEmpty(), is(true)); assertThat(ts.getLastError(), instanceOf(IllegalArgumentException.class)); assertThat(ts.isComplete(), is(false)); }