source: protocol/src/test/java/geniusweb/protocol/session/amop/WillBeCalledTest.java@ 26

Last change on this file since 26 was 26, checked in by bart, 4 years ago

Voting requests now contain Offers. Fixed windows whitespace issue. Partiesserver now supports up to 8 parties simultaneously.

File size: 698 bytes
Line 
1package geniusweb.protocol.session.amop;
2
3import static org.junit.Assert.assertEquals;
4
5import org.junit.Test;
6
7public class WillBeCalledTest {
8 int counter;
9
10 @Test
11 public void testDeadline() throws InterruptedException {
12 counter = 0;
13 new WillBeCalled(() -> {
14 counter++;
15 }, 100l);
16 assertEquals(0, counter);
17 Thread.sleep(200);
18 assertEquals(1, counter);
19 Thread.sleep(200);
20 assertEquals(1, counter);
21
22 }
23
24 @Test
25 public void testManual() throws InterruptedException {
26 counter = 0;
27 WillBeCalled w = new WillBeCalled(() -> {
28 counter++;
29 }, 100l);
30 assertEquals(0, counter);
31 w.complete();
32 assertEquals(1, counter);
33 Thread.sleep(200);
34 assertEquals(1, counter);
35
36 }
37}
Note: See TracBrowser for help on using the repository browser.