File tree Expand file tree Collapse file tree 4 files changed +15
-21
lines changed
src/test/java/com/intercom/api/integration Expand file tree Collapse file tree 4 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public void before() {
6464 .externalId (Utils .randomString ())
6565 .phone ("+353871234567" )
6666 .build ()));
67- contactId = contact .getId (). orElseThrow (() -> new RuntimeException ( "Contact ID is required" )) ;
67+ contactId = contact .getId ();
6868
6969 // act
7070 company = client .companies ()
@@ -151,8 +151,7 @@ public void testCreateLead() {
151151 try {
152152 client .contacts ()
153153 .delete (DeleteContactRequest .builder ()
154- .contactId (
155- response .getId ().orElseThrow (() -> new RuntimeException ("Contact ID is required" )))
154+ .contactId (response .getId ())
156155 .build ());
157156 } catch (Exception e ) {
158157 throw new RuntimeException ("Failed to delete contact." , e );
@@ -218,7 +217,7 @@ public void testDelete() {
218217 .role ("lead" )
219218 .name ("Roman Bowling" )
220219 .build ()));
221- String createdId = created .getId (). orElseThrow (() -> new RuntimeException ( "Contact ID is required" )) ;
220+ String createdId = created .getId ();
222221 ContactDeleted response = client .contacts ()
223222 .delete (DeleteContactRequest .builder ().contactId (createdId ).build ());
224223
@@ -234,7 +233,7 @@ public void testMergeLeadInUser() {
234233 .role ("lead" )
235234 .name ("Roman Bowling" )
236235 .build ()));
237- String leadId = lead .getId (). orElseThrow (() -> new RuntimeException ( "Lead ID is required" )) ;
236+ String leadId = lead .getId ();
238237 ContactsMergeLeadInUserResponse response = client .contacts ()
239238 .mergeLeadInUser (MergeContactsRequest .builder ()
240239 .leadId (leadId )
Original file line number Diff line number Diff line change @@ -86,19 +86,19 @@ public void before() {
8686 .externalId (Utils .randomString ())
8787 .name ("Baba Booey" )
8888 .build ()));
89- userId = user .getId (). orElseThrow (() -> new RuntimeException ( "User ID is required" )) ;
89+ userId = user .getId ();
9090 secondUser = client .contacts ()
9191 .create (CreateContactRequest .of (CreateContactRequest .WithExternalId .builder ()
9292 .externalId (Utils .randomString ())
9393 .name ("Babusha Boy" )
9494 .build ()));
95- secondUserId = secondUser .getId (). orElseThrow (() -> new RuntimeException ( "Second user ID is required" )) ;
95+ secondUserId = secondUser .getId ();
9696 lead = client .contacts ()
9797 .create (CreateContactRequest .of (CreateContactRequest .WithExternalId .builder ()
9898 .externalId (Utils .randomString ())
9999 .name ("Babushka Lead" )
100100 .build ()));
101- leadId = lead .getId (). orElseThrow (() -> new RuntimeException ( "Lead ID is required" )) ;
101+ leadId = lead .getId ();
102102
103103 Message conversationMessage = client .conversations ()
104104 .create (CreateConversationRequest .builder ()
@@ -120,14 +120,12 @@ public void before() {
120120 after ();
121121 }
122122
123- String msgConversationId = conversationMessage
124- .getConversationId ()
125- .orElseThrow (() -> new RuntimeException ("Conversation ID is required" ));
123+ String msgConversationId = conversationMessage .getConversationId ();
126124 conversation = client .conversations ()
127125 .find (FindConversationRequest .builder ()
128126 .conversationId (msgConversationId )
129127 .build ());
130- conversationId = conversation .getId (). orElseThrow (() -> new RuntimeException ( "Conversation ID is required" )) ;
128+ conversationId = conversation .getId ();
131129 }
132130
133131 @ AfterEach
Original file line number Diff line number Diff line change @@ -43,15 +43,15 @@ public void before() {
4343 .create (CreateContactRequest .of (CreateContactRequest .WithExternalId .builder ()
4444 .externalId (Utils .randomString ())
4545 .build ()));
46- contactId = contact .getId (). orElseThrow (() -> new RuntimeException ( "Contact ID is required" )) ;
46+ contactId = contact .getId ();
4747
4848 note = client .notes ()
4949 .create (CreateContactNoteRequest .builder ()
5050 .contactId (contactId )
5151 .body (Utils .randomString ())
5252 .adminId (adminId )
5353 .build ());
54- noteId = Integer .parseInt (note .getId (). orElseThrow (() -> new RuntimeException ( "Note ID is required" )) );
54+ noteId = Integer .parseInt (note .getId ());
5555 }
5656
5757 @ AfterEach
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ public void testTagContact() {
121121 .create (CreateContactRequest .of (CreateContactRequest .WithExternalId .builder ()
122122 .externalId (Utils .randomString ())
123123 .build ()));
124- String contactId = contact .getId (). orElseThrow (() -> new RuntimeException ( "Contact ID is required" )) ;
124+ String contactId = contact .getId ();
125125
126126 // act
127127 Tag response = client .tags ()
@@ -204,7 +204,7 @@ public void testTagConversation() {
204204 .externalId (Utils .randomString ())
205205 .name ("John Smith" )
206206 .build ()));
207- String contactId = contact .getId (). orElseThrow (() -> new RuntimeException ( "Contact ID is required" )) ;
207+ String contactId = contact .getId ();
208208
209209 Message conversationMessage = client .conversations ()
210210 .create (CreateConversationRequest .builder ()
@@ -228,12 +228,9 @@ public void testTagConversation() {
228228
229229 Conversation conversation = client .conversations ()
230230 .find (FindConversationRequest .builder ()
231- .conversationId (conversationMessage
232- .getConversationId ()
233- .orElseThrow (() -> new RuntimeException ("Conversation ID is required" )))
231+ .conversationId (conversationMessage .getConversationId ())
234232 .build ());
235- String conversationId =
236- conversation .getId ().orElseThrow (() -> new RuntimeException ("Conversation ID is required" ));
233+ String conversationId = conversation .getId ();
237234
238235 // act
239236 Tag response = client .tags ()
You can’t perform that action at this time.
0 commit comments