fix(instagram): map IG container copyright check status#1667
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a nested ChangesInstagram Copyright Check Status
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/restfb/types/instagram/IgContainerTest.java (1)
34-45: ⚡ Quick winAdd a failure-path test for missing
copyright_check_status.Per the coding guidelines, unit tests should assert both success and failure paths. The current test only covers the happy path. A second test covering a JSON payload without
copyright_check_statusshould be added to verify thatgetCopyrightCheckStatus()returnsnulland the container is still deserialised correctly.🧪 Suggested failure-path test
Add a second JSON fixture, e.g.
src/test/resources/json/instagram/container_no_copyright.json:{ "id": "17889615691921648", "status": "in_progress", "status_code": "IN_PROGRESS" }Then extend the test class:
+import static org.junit.jupiter.api.Assertions.assertNull; + class IgContainerTest extends AbstractJsonMapperTests { `@Test` void checkJson() { // ... existing assertions ... } + + `@Test` + void checkJsonWithoutCopyrightCheckStatus() { + IgContainer igContainer = createJsonMapper().toJavaObject( + jsonFromClasspath("instagram/container_no_copyright"), IgContainer.class); + + assertNotNull(igContainer); + assertEquals("17889615691921648", igContainer.getId()); + assertNull(igContainer.getCopyrightCheckStatus()); + } }As per coding guidelines: "Unit tests should assert both success and failure paths."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/test/java/com/restfb/types/instagram/IgContainerTest.java` around lines 34 - 45, Add a failing-path unit test in the IgContainerTest class that deserializes a JSON fixture without copyright_check_status (e.g., container_no_copyright.json) using createJsonMapper().toJavaObject(...) into IgContainer and asserts the object is non-null, id/status/statusCode match expected values ("17889615691921648", "in_progress", "IN_PROGRESS"), and that igContainer.getCopyrightCheckStatus() returns null; implement this as a separate `@Test` method (e.g., checkJson_missingCopyrightCheckStatus) to complement the existing checkJson test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/test/java/com/restfb/types/instagram/IgContainerTest.java`:
- Around line 34-45: Add a failing-path unit test in the IgContainerTest class
that deserializes a JSON fixture without copyright_check_status (e.g.,
container_no_copyright.json) using createJsonMapper().toJavaObject(...) into
IgContainer and asserts the object is non-null, id/status/statusCode match
expected values ("17889615691921648", "in_progress", "IN_PROGRESS"), and that
igContainer.getCopyrightCheckStatus() returns null; implement this as a separate
`@Test` method (e.g., checkJson_missingCopyrightCheckStatus) to complement the
existing checkJson test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e32989bb-7aa2-41b3-bfee-93786b349a78
📒 Files selected for processing (3)
src/main/lombok/com/restfb/types/instagram/IgContainer.javasrc/test/java/com/restfb/types/instagram/IgContainerTest.javasrc/test/resources/json/instagram/container.json
Summary
copyright_check_statusmapping toIgContainerVerification
mvn -Dtest=IgContainerTest testmvn testSummary by CodeRabbit
New Features
Tests