@Test public void simpleOn2Test() throws InterruptedException { AVar<Tuple2> val = new AVar<>(); firehose.on( Key.wrap("key1"), (key, value) -> { val.set(Tuple.of(key, value)); }); firehose.notify(Key.wrap("key1"), 1); assertThat(val.get(10, TimeUnit.MILLISECONDS), is(Tuple.of(Key.wrap("key1"), 1))); }
@Test public void keyMissTest() throws InterruptedException { AVar<Tuple2> val = new AVar<>(); firehose.miss( (k_) -> true, (k) -> { return Collections.singletonMap( k, (key, value) -> { val.set(Tuple.of(key, value)); }); }); firehose.notify(Key.wrap("key1"), 1); assertThat(val.get(10, TimeUnit.MILLISECONDS), is(Tuple.of(Key.wrap("key1"), 1))); }