Repository navigation
Expand file tree
/
Copy pathEndpointTest.java
More file actions
113 lines (87 loc) · 3.04 KB
/
Copy pathEndpointTest.java
File metadata and controls
113 lines (87 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.pubnub.api.endpoints;
import com.pubnub.api.PubNub;
import com.pubnub.api.PubNubException;
import com.pubnub.api.enums.PNOperationType;
import okhttp3.Request;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class EndpointTest extends TestHarness {
private PubNub pubnub;
@Before
public void beforeEach() throws IOException {
pubnub = this.createPubNubInstance(8080);
pubnub.getConfiguration().setIncludeInstanceIdentifier(true);
}
@Test
public void testBaseParams() throws PubNubException {
Endpoint<Object, Object> endpoint = new Endpoint<Object, Object>(pubnub, null) {
@Override
protected List<String> getAffectedChannels() {
return null;
}
@Override
protected List<String> getAffectedChannelGroups() {
return null;
}
@Override
protected void validateParams() throws PubNubException {
}
@Override
protected Object createResponse(Response input) throws PubNubException {
return null;
}
@Override
protected PNOperationType getOperationType() {
return null;
}
@Override
protected boolean isAuthRequired() {
return true;
}
@Override
protected Call doWork(Map baseParams) throws PubNubException {
Call<Object> fakeCall = new Call<Object>() {
@Override
public Response<Object> execute() throws IOException {
Response<Object> newResponse = Response.success(null);
return newResponse;
}
@Override
public void enqueue(Callback<Object> callback) {
}
@Override
public boolean isExecuted() {
return false;
}
@Override
public void cancel() {
}
@Override
public boolean isCanceled() {
return false;
}
@Override
public Call<Object> clone() {
return this;
}
@Override
public Request request() {
return null;
}
};
Assert.assertEquals("myUUID",baseParams.get("uuid"));
Assert.assertEquals("PubNubRequestId",baseParams.get("requestid"));
Assert.assertEquals("PubNubInstanceId",baseParams.get("instanceid"));
return fakeCall;
}
};
endpoint.sync();
}
}