1616
1717package com .linecorp .bot .client ;
1818
19+ import static java .util .Collections .singleton ;
20+
1921import java .io .IOException ;
2022import java .net .URL ;
2123import java .util .Map ;
24+ import java .util .concurrent .Callable ;
2225
2326import org .junit .Assume ;
2427import org .junit .Before ;
2730
2831import com .fasterxml .jackson .databind .ObjectMapper ;
2932
33+ import com .linecorp .bot .model .Broadcast ;
34+ import com .linecorp .bot .model .Multicast ;
35+ import com .linecorp .bot .model .PushMessage ;
36+ import com .linecorp .bot .model .message .TextMessage ;
3037import com .linecorp .bot .model .response .GetNumberOfFollowersResponse ;
3138import com .linecorp .bot .model .response .GetNumberOfMessageDeliveriesResponse ;
3239import com .linecorp .bot .model .response .NumberOfMessagesResponse ;
4249public class LineMessagingClientImplIntegrationTest {
4350 public static final URL TEST_RESOURCE = ClassLoader .getSystemResource ("integration_test_settings.yml" );
4451 private LineMessagingClient target ;
52+ private String userId ;
4553
4654 @ Before
4755 public void setUp () throws IOException {
@@ -54,6 +62,44 @@ public void setUp() throws IOException {
5462 .builder ((String ) map .get ("token" ))
5563 .apiEndPoint ((String ) map .get ("endpoint" ))
5664 .build ();
65+
66+ userId = (String ) map .get ("userId" );
67+ }
68+
69+ private static void testApiCall (Callable <Object > f ) throws Exception {
70+ final Object response = f .call ();
71+ log .info (response .toString ());
72+ }
73+
74+ @ Test
75+ public void broadcast () throws Exception {
76+ testApiCall (
77+ () -> target .broadcast (new Broadcast (new TextMessage ("Broadcast" ), true )).get ()
78+ );
79+ testApiCall (
80+ () -> target .broadcast (new Broadcast (new TextMessage ("Broadcast" ))).get ()
81+ );
82+ }
83+
84+ @ Test
85+ public void multicast () throws Exception {
86+ testApiCall (
87+ () -> target .multicast (new Multicast (singleton (userId ), new TextMessage ("Multicast" ), true ))
88+ .get ()
89+ );
90+ testApiCall (
91+ () -> target .multicast (new Multicast (singleton (userId ), new TextMessage ("Multicast" ))).get ()
92+ );
93+ }
94+
95+ @ Test
96+ public void pushMessage () throws Exception {
97+ testApiCall (
98+ () -> target .pushMessage (new PushMessage (userId , new TextMessage ("Push" ), true )).get ()
99+ );
100+ testApiCall (
101+ () -> target .pushMessage (new PushMessage (userId , new TextMessage ("Push" ))).get ()
102+ );
57103 }
58104
59105 @ Test
0 commit comments