Skip to content

Commit 2363471

Browse files
Fix remaining test files for required field changes
Update MessagesTest, IntegrationTest, and CompaniesTest to remove .orElseThrow() calls that are no longer needed since the SDK now returns non-optional types. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f7c5477 commit 2363471

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

src/test/java/com/intercom/api/integration/CompaniesTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ public void before() {
4242
client.contacts().list(ListContactsRequest.builder().perPage(1).build());
4343

4444
// act
45-
contactId = randomContacts
46-
.getItems()
47-
.get(0)
48-
.getId()
49-
.orElseThrow(() -> new RuntimeException("Contact ID is required"));
45+
contactId = randomContacts.getItems().get(0).getId();
5046
company = client.companies()
5147
.createOrUpdate(java.util.Optional.of(CreateOrUpdateCompanyRequest.builder()
5248
.name(Utils.randomString())

src/test/java/com/intercom/api/integration/IntegrationTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ public void before() {
6161
.create(CreateContactRequest.of(CreateContactRequest.WithExternalId.builder()
6262
.externalId(Utils.randomString())
6363
.build()));
64-
userId = user.getId().orElseThrow(() -> new RuntimeException("User ID is required"));
64+
userId = user.getId();
6565
lead = client.contacts()
6666
.create(CreateContactRequest.of(CreateContactRequest.WithRole.builder()
6767
.role("lead")
6868
.name("Marek Barek")
6969
.build()));
70-
leadId = lead.getId().orElseThrow(() -> new RuntimeException("Lead ID is required"));
70+
leadId = lead.getId();
7171
tag = client.tags()
7272
.create(TagsCreateRequestBody.of(CreateOrUpdateTagRequest.builder()
7373
.name(Utils.randomString())
@@ -126,8 +126,7 @@ public void testTagConversation() {
126126
// act
127127
Tag response = client.tags()
128128
.tagConversation(TagConversationRequest.builder()
129-
.conversationId(message.getConversationId()
130-
.orElseThrow(() -> new RuntimeException("Conversation ID is required")))
129+
.conversationId(message.getConversationId())
131130
.tagId(tag.getId())
132131
.adminId(adminId)
133132
.build());

src/test/java/com/intercom/api/integration/MessagesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void before() {
4242
.externalId(Utils.randomString())
4343
.name("Message Test User")
4444
.build()));
45-
userId = user.getId().orElseThrow(() -> new RuntimeException("User ID is required"));
45+
userId = user.getId();
4646
}
4747

4848
@AfterEach

0 commit comments

Comments
 (0)