Skip to content

Commit 145dde6

Browse files
author
Max Presman
committed
adjust tests
1 parent a126735 commit 145dde6

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎src/main/java/com/pubnub/api/endpoints/pubsub/Publish.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected final Call<List<Object>> doWork(Map<String, String> params) throws Pub
9393
params.put("seqn", String.valueOf(publishSequenceManager.getNextSequence()));
9494

9595
if (!replicate) {
96-
params.put("norep", String.valueOf(true));
96+
params.put("norep", "true");
9797
}
9898

9999
if (this.getPubnub().getConfiguration().getCipherKey() != null) {

‎src/test/java/com/pubnub/api/endpoints/pubsub/PublishTest.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static com.github.tomakehurst.wiremock.client.WireMock.*;
2121
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertNull;
2223

2324
public class PublishTest extends TestHarness {
2425

@@ -46,6 +47,8 @@ public void testFireSuccessSync() throws PubNubException, InterruptedException {
4647
List<LoggedRequest> requests = findAll(getRequestedFor(urlMatching("/.*")));
4748
assertEquals(1, requests.size());
4849
assertEquals("myUUID", requests.get(0).queryParameter("uuid").firstValue());
50+
assertEquals("true", requests.get(0).queryParameter("norep").firstValue());
51+
assertEquals("0", requests.get(0).queryParameter("store").firstValue());
4952
}
5053

5154
@Test
@@ -59,19 +62,21 @@ public void testNoRepSuccessSync() throws PubNubException, InterruptedException
5962
List<LoggedRequest> requests = findAll(getRequestedFor(urlMatching("/.*")));
6063
assertEquals(1, requests.size());
6164
assertEquals("myUUID", requests.get(0).queryParameter("uuid").firstValue());
65+
assertEquals("true", requests.get(0).queryParameter("norep").firstValue());
6266
}
6367

6468
@Test
6569
public void testRepDefaultSuccessSync() throws PubNubException, InterruptedException {
6670

67-
stubFor(get(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/coolChannel/0/%22hi%22"))
71+
stubFor(get(urlPathEqualTo("/publish/myPublishKey/mySubscribeKey/0/coolChannel/0/%22hirep%22"))
6872
.willReturn(aResponse().withBody("[1,\"Sent\",\"14598111595318003\"]")));
6973

70-
instance.channel("coolChannel").message("hi").sync();
74+
instance.channel("coolChannel").message("hirep").sync();
7175

7276
List<LoggedRequest> requests = findAll(getRequestedFor(urlMatching("/.*")));
7377
assertEquals(1, requests.size());
7478
assertEquals("myUUID", requests.get(0).queryParameter("uuid").firstValue());
79+
assertNull(requests.get(0).queryParameter("norep"));
7580
}
7681

7782

0 commit comments

Comments
 (0)