Skip to content

fix(instagram): map IG container copyright check status#1667

Merged
nbartels merged 2 commits into
devfrom
fix/ig-container-fields
May 7, 2026
Merged

fix(instagram): map IG container copyright check status#1667
nbartels merged 2 commits into
devfrom
fix/ig-container-fields

Conversation

@nbartels

@nbartels nbartels commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add copyright_check_status mapping to IgContainer
  • Cover IG container JSON mapping with a unit test and fixture

Verification

  • mvn -Dtest=IgContainerTest test
  • mvn test

Summary by CodeRabbit

  • New Features

    • Instagram containers now include copyright check status, exposing check completion state and whether matches were found.
  • Tests

    • Added tests covering JSON deserialization for containers with and without copyright check status.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36228b06-052e-420a-b008-2994a4c436ce

📥 Commits

Reviewing files that changed from the base of the PR and between e6f8d10 and 22a6c5b.

📒 Files selected for processing (2)
  • src/test/java/com/restfb/types/instagram/IgContainerTest.java
  • src/test/resources/json/instagram/container_no_copyright.json
✅ Files skipped from review due to trivial changes (1)
  • src/test/java/com/restfb/types/instagram/IgContainerTest.java

📝 Walkthrough

Walkthrough

Adds a nested CopyrightCheckStatus type to IgContainer, a copyrightCheckStatus field, and test fixtures/tests to validate JSON deserialization of the new nested structure.

Changes

Instagram Copyright Check Status

Layer / File(s) Summary
Data Shape & New Types
src/main/lombok/com/restfb/types/instagram/IgContainer.java
Import AbstractFacebookType. Add nested CopyrightCheckStatus class extending AbstractFacebookType with status and matchesFound (@Facebook("matches_found")) fields.
Core Model Integration
src/main/lombok/com/restfb/types/instagram/IgContainer.java
Add private CopyrightCheckStatus copyrightCheckStatus; field to IgContainer.
Tests & Test Resources
src/test/java/com/restfb/types/instagram/IgContainerTest.java, src/test/resources/json/instagram/container.json, src/test/resources/json/instagram/container_no_copyright.json
Add tests deserializing container.json (with copyright_check_status) and container_no_copyright.json (without it), asserting id, status, statusCode, and presence/absence and contents of copyrightCheckStatus.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰
A nested class tucked neat and small,
I hop through JSON, checking all,
Status found and matches true,
Tests ensure the data flew,
A tiny change — a happy call.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: adding copyright check status mapping to the Instagram container model, which aligns with the primary modification in IgContainer.java.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ig-container-fields

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/test/java/com/restfb/types/instagram/IgContainerTest.java (1)

34-45: ⚡ Quick win

Add 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_status should be added to verify that getCopyrightCheckStatus() returns null and 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

📥 Commits

Reviewing files that changed from the base of the PR and between a084927 and e6f8d10.

📒 Files selected for processing (3)
  • src/main/lombok/com/restfb/types/instagram/IgContainer.java
  • src/test/java/com/restfb/types/instagram/IgContainerTest.java
  • src/test/resources/json/instagram/container.json

@nbartels nbartels self-assigned this May 4, 2026
@nbartels nbartels added this to the 2026.6.0 milestone May 4, 2026
@nbartels
nbartels merged commit 8ba2c73 into dev May 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant