724725726727728729730731732733734
ch1.send(2); ch1.send(3); ch1.send(4); ch1.send(5); ch1.close(); fib.join(); } @Test public void testFlatmapWithTimeoutsThreadToFiber() throws Exception { final Channel<Integer> ch1 = newChannel();
142143144145146147148149150151152
ch.send("a message"); } }).start(); fib1.join(); fib2.join(); } @Test public void sendMessageFromThreadToFiber() throws Exception { final Channel<String> ch = newChannel();
161162163164165166167168169170171
}).start(); Thread.sleep(50); ch.send("a message"); fib.join(); } @Test public void sendMessageFromFiberToThread() throws Exception { final Channel<String> ch = newChannel();
181182183184185186187188189190191
String m = ch.receive(); assertThat(m, equalTo("a message")); fib.join(); } @Test public void sendMessageFromThreadToThread() throws Exception { final Channel<String> ch = newChannel();
241242243244245246247248249250251
assertTrue(thrown); } }).start(); fib1.join(); fib2.join(); } @Ignore @Test public void whenReceiveNotCalledFromOwnerThenThrowException2() throws Exception {
270271272273274275276277278279280
} catch (Throwable e) { thrown = true; } assertTrue(thrown); fib.join(); } @Ignore @Test public void whenReceiveNotCalledFromOwnerThenThrowException3() throws Exception {
300301302303304305306307308309310
String m = ch.receive(); assertThat(m, equalTo("a message")); fib.join(); } @Ignore @Test public void whenReceiveNotCalledFromOwnerThenThrowException4() throws Exception {
447448449450451452453454455456457
ch.close(); ch.send(6); ch.send(7); fib.join(); } @Test public void testChannelCloseException() throws Exception { final Channel<Integer> ch = newChannel();
485486487488489490491492493494495
ch.close(new Exception("foo")); ch.send(6); ch.send(7); fib.join(); } @Test public void testChannelCloseWithSleep() throws Exception { final Channel<Integer> ch = newChannel();
521522523524525526527528529530531
ch.close(); ch.send(6); ch.send(7); fib.join(); } @Test public void testChannelCloseExceptionWithSleep() throws Exception { final Channel<Integer> ch = newChannel();