Skip to content

Add objectIdStr field to Event model#171

Merged
ggoranov-smar merged 11 commits into
smartsheet:mainlinefrom
vitoraykov:feature/AUD-904-add-objectidstr-field
May 28, 2026
Merged

Add objectIdStr field to Event model#171
ggoranov-smar merged 11 commits into
smartsheet:mainlinefrom
vitoraykov:feature/AUD-904-add-objectidstr-field

Conversation

@vitoraykov
Copy link
Copy Markdown
Contributor

@vitoraykov vitoraykov commented May 27, 2026

Summary

Adds objectIdStr to the Event class to support the alphanumeric object identifier returned by the Audit 2.0 events endpoint. The existing objectId field remains unchanged — this is a purely additive, backward-compatible change.

Changes

  • Added private String objectIdStr field to Event.java
  • Added getObjectIdStr() and setObjectIdStr() with full Javadoc including @return
  • Setter follows the existing builder pattern (returns this)
  • CHANGELOG entry added under [x.x.x] - unreleased

Tests

  • New EventTest covering Jackson deserialization with the field present, absent, and explicitly null, plus builder pattern chaining
  • Updated listEvents.json fixture to include objectIdStr on one event and omit it on the other, exercising both code paths
  • Added objectIdStr assertions to both happy-path tests in EventResourcesImplTest
  • New TestListEvents WireMock contract tests covering objectIdStr deserialization, pagination flags, and 404 error handling

How to test

# Unit tests
./gradlew test --tests "com.smartsheet.api.models.EventTest" \
               --tests "com.smartsheet.api.internal.EventResourcesImplTest"

Vito Raykov added 3 commits May 27, 2026 13:39
- Add objectIdStr field to support alphanumeric object identifiers
- Getter and setter with builder pattern (returns this)
- Javadoc on both methods including @return
- CHANGELOG entry under [x.x.x] - unreleased
- Relates to AUD-904
- EventTest covers Jackson deserialization with/without field and builder pattern
- Update listEvents.json fixture to include objectIdStr on one event
- Add objectIdStr assertions to EventResourcesImplTest
- Verify objectIdStr deserialization via mock API stubs
- Cover moreAvailable true/false and 404 error cases
@vitoraykov vitoraykov changed the title Feature/aud 904 add objectidstr field Add objectIdStr field to Event model May 27, 2026
vitoraykov and others added 3 commits May 27, 2026 15:42
- Add testListEventsGeneratedUrlIsCorrect (URL, method, query params)
- Add testListEventsAllResponseBodyProperties with full recursive
  comparison against a new all-response-body-properties WireMock fixture
- Upgrade required-properties tests to use usingRecursiveComparison()
  with typed EXPECTED_* constants covering all Event fields, including
  previously unasserted accessTokenName, eventTimestamp, and objectId
- Rename tests to follow testXxx naming conventions from TESTING.md
- Remove redundant testListEvents404Error (covered by 400 test)
- Expand EventTest.deserialize_doesNotAffectOtherFields to assert all
  fields present in JSON and verify absent fields remain null

Note: the all-response-body-properties WireMock fixture and the
required-properties fixtures need to be updated in smartsheet-sdk-tests
to match the new EXPECTED_* constants.
Comment thread src/test/java/com/smartsheet/api/models/EventTest.java
Vito Raykov added 4 commits May 28, 2026 14:38
…k fixtures

- Fix copyright year 2026 → 2025 in TestListEvents and EventTest
- Align expected constants with actual WireMock fixture data (correct event
  IDs, timestamps, objectTypes, sources, additionalDetails for all 5 events)
- Fix WireMock mapping paths: non-existent all-response-body-properties
  replaced with required-response-body-properties-no-more-available
- Use Map.<String, Object>of() type witness for additionalDetails to satisfy
  Map<String, Object> parameter type
- Skip eventTimestamp in recursive comparison (timezone-sensitive Date
  construction); assert isNotNull() per event instead
- Replace individual query param key checks with whole-map Map<String,
  List<String>> assertion per TESTING.md full-object assertion requirements
- Expand EventTest.deserialize_doesNotAffectOtherFields to assert all fields
…stEventsModel

Relocate per reviewer feedback: unit tests for the Event model should live
in an events subfolder and be named after the endpoint being tested.
Correct the previous misdirected refactor — TestListEvents.java belongs
in sdktest/events/ (matching the reports/ pattern), not EventTest.java.
Also restores EventTest.java to com.smartsheet.api.models.
…ures

Update TestListEvents to match the new all-response-body-properties and
required-response-body-properties fixture structure. Replace the two
constants (shared events + moreAvailable variants) with dedicated constant
sets per fixture. Drop testListEventsMoreAvailableNavigation in favour of
testListEventsRequiredResponseBodyProperties.
Comment thread src/test/java/com/smartsheet/api/sdktest/events/TestListEvents.java Outdated
Comment thread src/test/java/com/smartsheet/api/sdktest/events/TestListEvents.java Outdated
…l assertions

Now that fixture timestamps and expected constants are aligned, the full
recursive comparison works correctly without excluding eventTimestamp.
@ggoranov-smar ggoranov-smar merged commit 6421579 into smartsheet:mainline May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants