Repository navigation
Expand file tree
/
Copy pathEndpointTest.java
More file actions
106 lines (80 loc) · 2.82 KB
/
Copy pathEndpointTest.java
File metadata and controls
106 lines (80 loc) · 2.82 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
package com.pubnub.api.endpoints;
import com.pubnub.api.PubNub;
import com.pubnub.api.PubNubException;
import com.pubnub.api.endpoints.channel_groups.RemoveChannelChannelGroup;
import com.pubnub.api.enums.PNOperationType;
import com.pubnub.api.models.consumer.channel_group.PNChannelGroupsRemoveChannelResult;
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.Arrays;
import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.Assert.assertNotNull;
public class EndpointTest extends TestHarness {
PubNub pubnub;
@Before
public void beforeEach() throws IOException {
pubnub = this.createPubNubInstance(8080);
}
@Test
public void testUUID() throws PubNubException {
Endpoint<Object, Object> endpoint = new Endpoint<Object, Object>(pubnub, 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 null;
}
@Override
public Request request() {
return null;
}
};
Assert.assertEquals("myUUID",baseParams.get("uuid"));
return fakeCall;
}
};
endpoint.sync();
}
}