@@ -25,126 +25,4 @@ class RaygunMessageTest {
2525 message.occurredOn == customOccurredOn,
2626 )
2727 }
28-
29- @Test
30- fun `parse payload` () {
31- // Example payload from https://raygun.com/documentation/product-guides/crash-reporting/api/
32- val payload = """
33- {
34- "occurredOn": "2015-09-08T01:55:28Z",
35- "details": {
36- "machineName": "ServerMachine1",
37- "groupingKey": "ErrorGroup",
38- "version": "1.0.0.1",
39- "client": {
40- "name": "Example Raygun Client",
41- "version": "0.0.0.1",
42- "clientUrl": "/documentation/integrations/api"
43- },
44- "error": {
45- "innerError": {},
46- "data": {
47- "example": 5
48- },
49- "className": "ErrorClass",
50- "message": "An error occurred",
51- "stackTrace": [
52- {
53- "lineNumber": 55,
54- "className": "BrokenService",
55- "columnNumber": 23,
56- "fileName": "BrokenService.cs",
57- "methodName": "BreakEverything()"
58- }]
59- },
60- "environment": {
61- "processorCount": 4,
62- "osVersion": "Windows 10",
63- "windowBoundsWidth": 2560,
64- "windowBoundsHeight": 1440,
65- "browser-Width": 2560,
66- "browser-Height": 1440,
67- "screen-Width": 2560,
68- "screen-Height": 1440,
69- "resolutionScale": 1.0,
70- "color-Depth": 24,
71- "currentOrientation": "Landscape",
72- "cpu": "Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz",
73- "packageVersion": "package version",
74- "architecture": "ARMv7-A",
75- "deviceManufacturer": "Nokia",
76- "model": "Lumia 920",
77- "totalPhysicalMemory": 1024,
78- "availablePhysicalMemory": 16,
79- "totalVirtualMemory": 16,
80- "availableVirtualMemory": 16,
81- "diskSpaceFree": 50000,
82- "deviceName": "Nexus 7",
83- "locale": "en-nz",
84- "utcOffset": -12,
85- "browser": "Mozilla",
86- "browserName": "Netscape",
87- "browser-Version": "5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36",
88- "platform": "Win32"
89- },
90- "tags": ["tag1", "tag 2", "tag-3"],
91- "userCustomData": {
92- "domain": "WORKPLACE",
93- "area": "51"
94- },
95- "request": {
96- "hostName": "https://raygun.io",
97- "url": "/documentation/integrations/api",
98- "httpMethod": "POST",
99- "iPAddress": ["127.0.0.1"],
100- "queryString": {
101- "q": "searchParams"
102- },
103- "form": {
104- "firstName": "Example",
105- "lastName": "Person",
106- "newsletter": true
107- },
108- "headers": {
109- "Referer": "www.google.com",
110- "Host": "raygun.io"
111- },
112- "rawData": "{\"Test\": 5}"
113- },
114- "response": {
115- "statusCode": 500
116- },
117- "user": {
118- "identifier": "123456789",
119- "isAnonymous": false,
120- "email": "test@example.com",
121- "fullName": "Test User",
122- "firstName": "Test",
123- "uuid": "783491e1-d4a9-46bc-9fde-9b1dd9ef6c6e"
124- },
125- "breadcrumbs": [{
126- "timeStamp": 1504799959639,
127- "level": 1,
128- "type": "navigation",
129- "category": "checkout",
130- "message": "User navigated to the shopping cart",
131- "className": "ShoppingCart",
132- "methodName": "ViewBasket",
133- "lineNumber": 156,
134- "customData": { "from": "/category/product/123", "to": "/cart/view" }
135- }]
136- }
137- }
138- """ .trimIndent()
139- val actual = Gson ().fromJson(payload, RaygunMessage ::class .java)
140-
141- val expected = RaygunMessage (
142- occurredOn = " 2015-09-08T01:55:28Z" ,
143- details = RaygunMessageDetails (
144- groupingKey = " ErrorGroup"
145- )
146- )
147-
148- assertEquals(" original and parsed payload match" , expected, actual)
149- }
15028}
0 commit comments