forked from getsentry/sentry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSentryIT.java
More file actions
67 lines (47 loc) · 1.78 KB
/
SentryIT.java
File metadata and controls
67 lines (47 loc) · 1.78 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
package io.sentry;
import io.sentry.connection.AbstractConnection;
import io.sentry.connection.LockdownManager;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static mockit.Deencapsulation.getField;
public class SentryIT extends BaseIT {
@Test
public void test500DoesLockdown() throws Exception {
stubForProject1Store(500);
verifyProject1PostRequestCount(0);
verifyStoredEventCount(0);
SentryClient client = SentryClientFactory.sentryClient();
client.sendMessage("Test");
verifyProject1PostRequestCount(1);
verifyStoredEventCount(0);
assertTrue(isLockedDown(client));
}
@Test
public void test403FilteredDoesNotLockdown() throws Exception {
stubForProject1Store(403);
verifyProject1PostRequestCount(0);
verifyStoredEventCount(0);
SentryClient client = SentryClientFactory.sentryClient();
client.sendMessage("Test");
verifyProject1PostRequestCount(1);
verifyStoredEventCount(0);
assertFalse(isLockedDown(client));
}
@Test
public void testSuccess() throws Exception {
stub200ForProject1Store();
verifyProject1PostRequestCount(0);
verifyStoredEventCount(0);
SentryClient client = SentryClientFactory.sentryClient();
client.sendMessage("Test");
verifyProject1PostRequestCount(1);
verifyStoredEventCount(1);
assertFalse(isLockedDown(client));
}
private boolean isLockedDown(SentryClient client) {
AbstractConnection connection = getField(client, "connection");
LockdownManager lockdownManager = getField(connection, "lockdownManager");
return lockdownManager.isLockedDown();
}
}