aboutsummaryrefslogtreecommitdiffstats
path: root/ui-client/src/test/java/market/guess
diff options
context:
space:
mode:
Diffstat (limited to 'ui-client/src/test/java/market/guess')
-rw-r--r--ui-client/src/test/java/market/guess/ui/client/RemoteContextsTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui-client/src/test/java/market/guess/ui/client/RemoteContextsTest.java b/ui-client/src/test/java/market/guess/ui/client/RemoteContextsTest.java
index e3b11f0..ea9d5ea 100644
--- a/ui-client/src/test/java/market/guess/ui/client/RemoteContextsTest.java
+++ b/ui-client/src/test/java/market/guess/ui/client/RemoteContextsTest.java
@@ -72,7 +72,7 @@ class RemoteContextsTest {
72 72
73 maya.pull(); 73 maya.pull();
74 var heard = new CountDownLatch(1); 74 var heard = new CountDownLatch(1);
75 maya.startPolling(heard::countDown); 75 maya.startPolling(heard::countDown, said -> {});
76 var bought = 76 var bought =
77 tomMarket.placeOrder("Tom", event.key(), event.key() + ":0", "BUY", BigDecimal.ONE, 10); 77 tomMarket.placeOrder("Tom", event.key(), event.key() + ":0", "BUY", BigDecimal.ONE, 10);
78 assertTrue(bought.isSuccess(), bought.getMessage()); 78 assertTrue(bought.isSuccess(), bought.getMessage());
@@ -150,6 +150,28 @@ class RemoteContextsTest {
150 } 150 }
151 151
152 @Test 152 @Test
153 void chatReachesEveryoneOnceAndLeavesTheMarketAlone() {
154 try (var yael = new ServerClient(server.api);
155 var zohar = new ServerClient(server.api)) {
156 yael.login("Yael");
157 zohar.login("Zohar");
158 zohar.pullChat(); // whatever other tests said
159 zohar.pull();
160
161 var hello = "שלום, anyone trading?";
162 assertTrue(yael.say(hello).isSuccess());
163 assertFalse(yael.say(" ").isSuccess());
164
165 var heard = zohar.pullChat();
166 assertEquals(1, heard.size());
167 assertEquals("Yael", heard.get(0).sender());
168 assertEquals(hello, heard.get(0).text());
169 assertTrue(zohar.pullChat().isEmpty(), "a message is delivered once");
170 assertFalse(zohar.pull(), "chat must not look like a market change");
171 }
172 }
173
174 @Test
153 void anUnreachableServerIsAFailedResultNotAnException() { 175 void anUnreachableServerIsAFailedResultNotAnException() {
154 try (var nobody = new ServerClient("http://localhost:1/api")) { 176 try (var nobody = new ServerClient("http://localhost:1/api")) {
155 assertFalse(nobody.login("Zed").isSuccess()); 177 assertFalse(nobody.login("Zed").isSuccess());