Skip to content

GH-127 Add integration tests for each repository #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Jakubk15
Copy link
Member

No description provided.

@Jakubk15 Jakubk15 requested review from CitralFlo and vLuckyyy July 20, 2025 19:58
Copy link
Contributor

coderabbitai bot commented Jul 20, 2025

Walkthrough

This update adds several new integration test classes for various repository components, each using a MySQL database container to verify saving, retrieving, and removing data. Two existing test classes were updated to explicitly set the database type to MySQL. The build configuration was changed to downgrade the Spigot API and Minecraft versions for compile and runServer tasks, and some dependencies were added to the testImplementation scope. No public APIs were changed outside of the new tests and minor test adjustments.

Estimated code review effort

3 (~45 minutes)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03cef34 and 5526bf4.

📒 Files selected for processing (7)
  • build.gradle.kts (3 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/DeliveryRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/ItemStorageRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/LockerRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/ParcelContentRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/ParcelRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/UserRepositoryIntegrationTest.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/test/java/com/eternalcode/parcellockers/database/LockerRepositoryIntegrationTest.java
  • build.gradle.kts
  • src/test/java/com/eternalcode/parcellockers/database/UserRepositoryIntegrationTest.java
  • src/test/java/com/eternalcode/parcellockers/database/ItemStorageRepositoryIntegrationTest.java
  • src/test/java/com/eternalcode/parcellockers/database/ParcelContentRepositoryIntegrationTest.java
  • src/test/java/com/eternalcode/parcellockers/database/DeliveryRepositoryIntegrationTest.java
🔇 Additional comments (1)
src/test/java/com/eternalcode/parcellockers/database/ParcelRepositoryIntegrationTest.java (1)

48-48: Good addition - ensures consistent MySQL configuration.

Explicitly setting the database type to MySQL aligns perfectly with the MySQL container setup and ensures the test runs with the intended database configuration.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (8)
src/test/java/com/eternalcode/parcellockers/database/DeliveryRepositoryIntegrationTest.java (1)

39-39: Use descriptive test method name.

The method name "test" doesn't describe what's being tested. Consider a more descriptive name like shouldSaveRetrieveAndRemoveDelivery.

-void test() {
+void shouldSaveRetrieveAndRemoveDelivery() {
src/test/java/com/eternalcode/parcellockers/database/UserRepositoryIntegrationTest.java (3)

29-29: Use consistent MySQL container setup.

This test uses a different MySQL container setup compared to other tests. Consider using the same pattern with DockerImageName.parse("mysql:latest") for consistency.

-private static final MySQLContainer container = new MySQLContainer();
+private static final MySQLContainer container = new MySQLContainer(DockerImageName.parse("mysql:latest"));

40-40: Use consistent logger setup.

This test passes null for the logger while other tests use Logger.getLogger("ParcelLockers"). Keep it consistent.

-DatabaseManager databaseManager = new DatabaseManager(config, null, dataFolder);
+DatabaseManager databaseManager = new DatabaseManager(config, Logger.getLogger("ParcelLockers"), dataFolder);

37-37: Use descriptive test method name.

The method name "test" doesn't describe what's being tested. Consider a more descriptive name like shouldSaveRetrieveAndPageUsers.

-void test() {
+void shouldSaveRetrieveAndPageUsers() {
src/test/java/com/eternalcode/parcellockers/database/ParcelContentRepositoryIntegrationTest.java (2)

25-25: Consider using MySQL container for consistency.

This test doesn't use a MySQL container like the other integration tests. Consider adding @Testcontainers and a MySQL container for consistent database testing.


33-33: Use descriptive test method name.

The method name "test" doesn't describe what's being tested. Consider a more descriptive name like shouldSaveRetrieveAndRemoveParcelContent.

-void test() {
+void shouldSaveRetrieveAndRemoveParcelContent() {
src/test/java/com/eternalcode/parcellockers/database/ItemStorageRepositoryIntegrationTest.java (2)

38-38: Use descriptive test method name.

The method name "test" doesn't describe what's being tested. Consider a more descriptive name like shouldSaveRetrieveAndRemoveItemStorage.

-void test() {
+void shouldSaveRetrieveAndRemoveItemStorage() {

48-49: ItemStack comparison may not work as expected.

The contains check might fail because ItemStack equality can be tricky. Consider comparing the material and amount separately for more reliable assertions.

-assertTrue(retrievedItemStorage.get().items().contains(new ItemStack(Material.GOLD_BLOCK, 64)),
-    "ItemStorage should contain the saved item");
+var items = retrievedItemStorage.get().items();
+assertTrue(items.size() == 1 && items.get(0).getType() == Material.GOLD_BLOCK && items.get(0).getAmount() == 64,
+    "ItemStorage should contain the saved item");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9038690 and 5cf2db5.

📒 Files selected for processing (6)
  • build.gradle.kts (2 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/DeliveryRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/ItemStorageRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/LockerRepositoryIntegrationTest.java (0 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/ParcelContentRepositoryIntegrationTest.java (1 hunks)
  • src/test/java/com/eternalcode/parcellockers/database/UserRepositoryIntegrationTest.java (1 hunks)
💤 Files with no reviewable changes (1)
  • src/test/java/com/eternalcode/parcellockers/database/LockerRepositoryIntegrationTest.java

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 20, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 20, 2025
@Jakubk15 Jakubk15 changed the title Add integration tests for each repository GH-127 Add integration tests for each repository Jul 21, 2025
@P1otrulla P1otrulla self-requested a review July 21, 2025 23:08
P1otrulla
P1otrulla previously approved these changes Jul 21, 2025
Copy link
Member

@P1otrulla P1otrulla left a comment

Choose a reason for hiding this comment

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

Im not good at tests but I think its okey. Good Job Jakub! 😎

@Jakubk15 Jakubk15 dismissed stale reviews from P1otrulla and coderabbitai[bot] via 5526bf4 July 22, 2025 11:48
CitralFlo
CitralFlo previously approved these changes Jul 23, 2025
Copy link
Member

@CitralFlo CitralFlo left a comment

Choose a reason for hiding this comment

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

It looks good, check if it works and merge it!

@vLuckyyy vLuckyyy requested review from Rollczi and removed request for vLuckyyy August 5, 2025 14:43
# Conflicts:
#	build.gradle.kts
@Jakubk15 Jakubk15 removed the request for review from Rollczi August 12, 2025 18:06
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.

3 participants