|
2 | 2 |
|
3 | 3 | import static org.junit.Assert.assertEquals;
|
4 | 4 | import static org.junit.Assert.assertNotNull;
|
| 5 | +import static org.junit.Assert.assertTrue; |
5 | 6 |
|
6 | 7 | import org.junit.Test;
|
7 | 8 | import org.zendesk.client.v2.model.events.AgentMacroReferenceEvent;
|
8 | 9 | import org.zendesk.client.v2.model.events.AttachmentRedactionEvent;
|
9 | 10 | import org.zendesk.client.v2.model.events.CommentRedactionEvent;
|
10 | 11 | import org.zendesk.client.v2.model.events.Event;
|
11 | 12 | import org.zendesk.client.v2.model.events.OrganizationActivityEvent;
|
| 13 | +import org.zendesk.client.v2.model.events.UnknownEvent; |
12 | 14 |
|
13 | 15 | import com.fasterxml.jackson.databind.ObjectMapper;
|
14 | 16 |
|
@@ -62,16 +64,26 @@ public void testCommentRedactionEvent() {
|
62 | 64 | assertEquals( "CommentRedactionEvent{commentId=18974155255}", ev.toString() );
|
63 | 65 | }
|
64 | 66 |
|
65 |
| - @Test |
66 |
| - public void testAgentMacroReferenceEvent() { |
67 |
| - String json = "{ \"id\": 789, \"type\": \"AgentMacroReference\", \"via\": { \"channel\": \"web\", \"source\": {" |
68 |
| - + "\"from\": {}, \"to\": {}, \"rel\": null } }, \"macro_title\": \"TheMacroTitle\", \"macro_id\": \"123\" }"; |
69 |
| - Event ev = parseJson( json.getBytes() ); |
70 |
| - assertNotNull(ev); |
71 |
| - assertEquals(AgentMacroReferenceEvent.class, ev.getClass()); |
72 |
| - assertEquals(new Long(789L), ev.getId()); |
73 |
| - assertEquals(new Long(123L), ((AgentMacroReferenceEvent) ev).getMacroId()); |
74 |
| - assertEquals("TheMacroTitle", ((AgentMacroReferenceEvent) ev).getMacroTitle()); |
75 |
| - assertNotNull(((AgentMacroReferenceEvent) ev).getVia()); |
76 |
| - } |
| 67 | + @Test |
| 68 | + public void testAgentMacroReferenceEvent() { |
| 69 | + String json = "{ \"id\": 789, \"type\": \"AgentMacroReference\", \"via\": { \"channel\": \"web\", \"source\": {" |
| 70 | + + "\"from\": {}, \"to\": {}, \"rel\": null } }, \"macro_title\": \"TheMacroTitle\", \"macro_id\": \"123\" }"; |
| 71 | + Event ev = parseJson( json.getBytes() ); |
| 72 | + assertNotNull(ev); |
| 73 | + assertEquals(AgentMacroReferenceEvent.class, ev.getClass()); |
| 74 | + assertEquals(new Long(789L), ev.getId()); |
| 75 | + assertEquals(new Long(123L), ((AgentMacroReferenceEvent) ev).getMacroId()); |
| 76 | + assertEquals("TheMacroTitle", ((AgentMacroReferenceEvent) ev).getMacroTitle()); |
| 77 | + assertNotNull(((AgentMacroReferenceEvent) ev).getVia()); |
| 78 | + } |
| 79 | + |
| 80 | + @Test |
| 81 | + public void testUnknownEvent() { |
| 82 | + String json = "{ \"id\": 123, \"type\": \"NotARealEventType\" }"; |
| 83 | + Event ev = parseJson(json.getBytes()); |
| 84 | + assertNotNull(ev); |
| 85 | + assertEquals(UnknownEvent.class, ev.getClass()); |
| 86 | + assertEquals("NotARealEventType", ((UnknownEvent) ev).getType()); |
| 87 | + assertTrue(ev.toString().contains("NotARealEventType")); |
| 88 | + } |
77 | 89 | }
|
0 commit comments