|
15 | 15 | */ |
16 | 16 | package com.stackify.api; |
17 | 17 |
|
| 18 | +import org.junit.Assert; |
| 19 | +import org.junit.Test; |
| 20 | + |
18 | 21 | import java.util.Collections; |
19 | 22 | import java.util.Date; |
20 | 23 | import java.util.Map; |
21 | 24 |
|
22 | | -import org.junit.Assert; |
23 | | -import org.junit.Test; |
24 | | - |
25 | 25 | /** |
26 | 26 | * StackifyError JUnit Test |
27 | 27 | * |
28 | 28 | * @author Eric Martin |
29 | 29 | */ |
30 | 30 | public class StackifyErrorTest { |
31 | 31 |
|
32 | | - /** |
33 | | - * testBuilder |
34 | | - */ |
35 | | - @Test |
36 | | - public void testBuilder() { |
37 | | - EnvironmentDetail environment = EnvironmentDetail.newBuilder().build(); |
38 | | - Date timeStamp = new Date(); |
39 | | - ErrorItem errorDetail = ErrorItem.newBuilder().build(); |
40 | | - WebRequestDetail webRequestDetail = WebRequestDetail.newBuilder().build(); |
41 | | - Map<String, String> serverVariables = Collections.singletonMap("serverKey", "serverValue"); |
42 | | - String customerName = "customerName"; |
43 | | - String userName = "userName"; |
| 32 | + /** |
| 33 | + * testBuilder |
| 34 | + */ |
| 35 | + @Test |
| 36 | + public void testBuilder() { |
| 37 | + EnvironmentDetail environment = EnvironmentDetail.newBuilder().build(); |
| 38 | + Date timeStamp = new Date(); |
| 39 | + ErrorItem errorDetail = ErrorItem.newBuilder().build(); |
| 40 | + WebRequestDetail webRequestDetail = WebRequestDetail.newBuilder().build(); |
| 41 | + Map<String, String> serverVariables = Collections.singletonMap("serverKey", "serverValue"); |
| 42 | + String customerName = "customerName"; |
| 43 | + String userName = "userName"; |
| 44 | + |
| 45 | + StackifyError.Builder builder = StackifyError.newBuilder(); |
| 46 | + builder.environmentDetail(environment); |
| 47 | + builder.occurredEpochMillis(timeStamp.getTime()); |
| 48 | + builder.error(errorDetail); |
| 49 | + builder.webRequestDetail(webRequestDetail); |
| 50 | + builder.serverVariables(serverVariables); |
| 51 | + builder.customerName(customerName); |
| 52 | + builder.userName(userName); |
| 53 | + StackifyError stackifyError = builder.build(); |
| 54 | + |
| 55 | + Assert.assertNotNull(stackifyError); |
44 | 56 |
|
45 | | - StackifyError.Builder builder = StackifyError.newBuilder(); |
46 | | - builder.environmentDetail(environment); |
47 | | - builder.occurredEpochMillis(timeStamp); |
48 | | - builder.error(errorDetail); |
49 | | - builder.webRequestDetail(webRequestDetail); |
50 | | - builder.serverVariables(serverVariables); |
51 | | - builder.customerName(customerName); |
52 | | - builder.userName(userName); |
53 | | - StackifyError stackifyError = builder.build(); |
| 57 | + Assert.assertEquals(environment, stackifyError.getEnvironmentDetail()); |
| 58 | + Assert.assertEquals(timeStamp.getTime(), (long) stackifyError.getOccurredEpochMillis()); |
| 59 | + Assert.assertEquals(errorDetail, stackifyError.getError()); |
| 60 | + Assert.assertEquals(webRequestDetail, stackifyError.getWebRequestDetail()); |
| 61 | + Assert.assertEquals(serverVariables, stackifyError.getServerVariables()); |
| 62 | + Assert.assertEquals(customerName, stackifyError.getCustomerName()); |
| 63 | + Assert.assertEquals(userName, stackifyError.getUserName()); |
54 | 64 |
|
55 | | - Assert.assertNotNull(stackifyError); |
| 65 | + StackifyError stackifyErrorCopy = stackifyError.toBuilder().build(); |
56 | 66 |
|
57 | | - Assert.assertEquals(environment, stackifyError.getEnvironmentDetail()); |
58 | | - Assert.assertEquals(timeStamp, stackifyError.getOccurredEpochMillis()); |
59 | | - Assert.assertEquals(errorDetail, stackifyError.getError()); |
60 | | - Assert.assertEquals(webRequestDetail, stackifyError.getWebRequestDetail()); |
61 | | - Assert.assertEquals(serverVariables, stackifyError.getServerVariables()); |
62 | | - Assert.assertEquals(customerName, stackifyError.getCustomerName()); |
63 | | - Assert.assertEquals(userName, stackifyError.getUserName()); |
64 | | - |
65 | | - StackifyError stackifyErrorCopy = stackifyError.toBuilder().build(); |
66 | | - |
67 | | - Assert.assertNotNull(stackifyErrorCopy); |
| 67 | + Assert.assertNotNull(stackifyErrorCopy); |
68 | 68 |
|
69 | | - Assert.assertEquals(environment, stackifyErrorCopy.getEnvironmentDetail()); |
70 | | - Assert.assertEquals(timeStamp, stackifyErrorCopy.getOccurredEpochMillis()); |
71 | | - Assert.assertEquals(errorDetail, stackifyErrorCopy.getError()); |
72 | | - Assert.assertEquals(webRequestDetail, stackifyErrorCopy.getWebRequestDetail()); |
73 | | - Assert.assertEquals(serverVariables, stackifyErrorCopy.getServerVariables()); |
74 | | - Assert.assertEquals(customerName, stackifyErrorCopy.getCustomerName()); |
75 | | - Assert.assertEquals(userName, stackifyErrorCopy.getUserName()); |
76 | | - } |
| 69 | + Assert.assertEquals(environment, stackifyErrorCopy.getEnvironmentDetail()); |
| 70 | + Assert.assertEquals(timeStamp.getTime(), (long) stackifyErrorCopy.getOccurredEpochMillis()); |
| 71 | + Assert.assertEquals(errorDetail, stackifyErrorCopy.getError()); |
| 72 | + Assert.assertEquals(webRequestDetail, stackifyErrorCopy.getWebRequestDetail()); |
| 73 | + Assert.assertEquals(serverVariables, stackifyErrorCopy.getServerVariables()); |
| 74 | + Assert.assertEquals(customerName, stackifyErrorCopy.getCustomerName()); |
| 75 | + Assert.assertEquals(userName, stackifyErrorCopy.getUserName()); |
| 76 | + } |
77 | 77 | } |
0 commit comments