Commit ef42d484 authored by Simeon Anfinrud's avatar Simeon Anfinrud Committed by Commit Bot

[Chromecast] Add test case for Observable#map().

reactive_java.md documents the expectation that the Observable
produced by map() is not activated when its source is activated
and the Function that transforms the activation data returns
null, but this expectation was not properly tested.

Bug: None
Test: cast_base_junit_tests
Change-Id: If8ff1764efe6790a9eeabcfeadf28b052ce924f5
Reviewed-on: https://chromium-review.googlesource.com/1120643Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: Simeon Anfinrud <sanfin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572289}
parent a3c54cfe
...@@ -362,6 +362,15 @@ public class ObservableAndControllerTest { ...@@ -362,6 +362,15 @@ public class ObservableAndControllerTest {
"exit upper")); "exit upper"));
} }
@Test
public void testMapDropsNullResult() {
Controller<Unit> controller = new Controller<>();
ReactiveRecorder recorder = ReactiveRecorder.record(controller.map(x -> null));
controller.set(Unit.unit());
// Recorder should not get any events because the map function returned null.
recorder.verify().end();
}
@Test @Test
public void testFilter() { public void testFilter() {
Controller<String> a = new Controller<>(); Controller<String> a = new Controller<>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment