Skip to content

커버리지 100 유지 하기위한 jacoco 플러그인 추가 그리고 GitHub Actions 워크플로우에 요소 추가#35

Merged
zzoe2346 merged 9 commits intomainfrom
32-커버리지-100-유지-하기위한-jacoco-플러그인-추가
Mar 10, 2025

Hidden character warning

The head ref may contain hidden characters: "32-\ucee4\ubc84\ub9ac\uc9c0-100-\uc720\uc9c0-\ud558\uae30\uc704\ud55c-jacoco-\ud50c\ub7ec\uadf8\uc778-\ucd94\uac00"
Merged

커버리지 100 유지 하기위한 jacoco 플러그인 추가 그리고 GitHub Actions 워크플로우에 요소 추가#35
zzoe2346 merged 9 commits intomainfrom
32-커버리지-100-유지-하기위한-jacoco-플러그인-추가

Conversation

@zzoe2346
Copy link
Owner

No description provided.

@zzoe2346 zzoe2346 added the enhancement New feature or request label Mar 10, 2025
@zzoe2346 zzoe2346 requested a review from Copilot March 10, 2025 06:14
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @zzoe2346, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on enhancing the project's test coverage by integrating JaCoCo, a code coverage tool. The primary goal is to enforce a 100% test coverage requirement. This is achieved through modifications to the Gradle build file and the addition of a new GitHub Actions workflow. Additionally, the pull request addresses a potential issue in utility classes by preventing their instantiation through private constructors.

Highlights

  • JaCoCo Integration: The pull request introduces JaCoCo to enforce 100% test coverage. This includes adding the JaCoCo plugin to the build.gradle file and configuring test coverage verification.
  • GitHub Actions Workflow: A new GitHub Actions workflow (testWhenPR.yml) is added to run tests, check coverage, and report coverage results on pull requests. It also uploads the JaCoCo report as an artifact.
  • Utility Class Constructor Protection: Mapper classes (JudgmentResultMapper, ReviewMapper, UserMapper) are modified to prevent instantiation by adding private constructors that throw an exception.

Changelog

Click here to see the changelog
  • .github/workflows/test.yml
    • Removed the original test workflow file.
  • .github/workflows/testWhenPR.yml
    • Added a new workflow to run tests, check JaCoCo coverage, and report results on pull requests.
    • Configured the workflow to upload JaCoCo reports as artifacts.
    • Added permissions to allow the workflow to add comments to PRs
  • build.gradle
    • Added the JaCoCo plugin.
    • Configured JaCoCo test report generation and verification tasks.
    • Set up test coverage verification to enforce a minimum of 100% coverage.
  • src/main/java/com/mycodingtest/judgmentresult/JudgmentResultMapper.java
    • Added a private constructor to prevent instantiation of this utility class.
  • src/main/java/com/mycodingtest/review/ReviewMapper.java
    • Added a private constructor to prevent instantiation of this utility class.
  • src/main/java/com/mycodingtest/user/UserMapper.java
    • Added a private constructor to prevent instantiation of this utility class.
  • src/test/java/com/mycodingtest/judgmentresult/JudgmentResultMapperTest.java
    • Added a test case to ensure that the private constructor of JudgmentResultMapper throws an exception when invoked.
  • src/test/java/com/mycodingtest/review/ReviewMapperTest.java
    • Added a test case to ensure that the private constructor of ReviewMapper throws an exception when invoked.
  • src/test/java/com/mycodingtest/user/UserMapperTest.java
    • Added a test case to ensure that the private constructor of UserMapper throws an exception when invoked.
    • Added a test case to test the toDetailInfoResponse method
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The name 'JaCoCo' is derived from 'Java Code Coverage'.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces JaCoCo plugin to maintain 100% test coverage. It includes changes to Gradle build file and GitHub Actions workflow. The addition of tests for mapper classes is also a good practice.

Summary of Findings

  • Workflow Duplication: The pull request introduces a new workflow file testWhenPR.yml while removing the original test.yml. It's important to ensure that the new workflow completely replaces the functionality of the old one and that there's no unintended loss of functionality.
  • Coverage Verification: The jacocoTestCoverageVerification task is configured to enforce 100% coverage. This is a good practice to ensure high code quality, but it's important to ensure that the tests are meaningful and not just covering trivial code paths.
  • Utility Class Constructor: The mapper classes now have private constructors that throw UnsupportedOperationException. This is a good way to prevent instantiation of utility classes.

Merge Readiness

The pull request is almost ready to be merged. Please address the comments regarding workflow duplication and ensure that the tests are meaningful. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR adds support for 100% test coverage by introducing the JaCoCo plugin in the GitHub Actions workflow and ensuring that utility mapper classes cannot be instantiated.

  • Added tests to verify private constructors for utility mapper classes
  • Injected private constructors into UserMapper, ReviewMapper, and JudgmentResultMapper to prevent instantiation
  • Added a GitHub Actions workflow to run tests and enforce 100% JaCoCo coverage

Reviewed Changes

File Description
src/test/java/com/mycodingtest/user/UserMapperTest.java Added tests for UserMapper including a private constructor test and a mapping validation test
src/test/java/com/mycodingtest/review/ReviewMapperTest.java Added a test to verify private constructor behavior for ReviewMapper
src/test/java/com/mycodingtest/judgmentresult/JudgmentResultMapperTest.java Added a test to verify private constructor behavior for JudgmentResultMapper
.github/workflows/testWhenPR.yml Introduced a workflow to run tests and enforce 100% JaCoCo coverage
src/main/java/com/mycodingtest/judgmentresult/JudgmentResultMapper.java Added a private constructor to enforce utility class pattern
src/main/java/com/mycodingtest/review/ReviewMapper.java Added a private constructor to enforce utility class pattern
src/main/java/com/mycodingtest/user/UserMapper.java Added a private constructor to enforce utility class pattern

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/main/java/com/mycodingtest/user/UserMapper.java:3

  • The imported type 'UserDetailInfoResoponse' seems misspelled; please update it to 'UserDetailInfoResponse' to ensure consistency across the codebase.
import com.mycodingtest.user.dto.UserDetailInfoResoponse;

@github-actions
Copy link

JaCoCo Test Coverage Report (100% Required)

Overall Project 100% 🍏
Files changed 100% 🍏

File Coverage
ReviewMapper.java 100% 🍏
JudgmentResultMapper.java 100% 🍏
UserMapper.java 100% 🍏

@zzoe2346 zzoe2346 changed the title 커버리지 100 유지 하기위한 jacoco 플러그인 추가 커버리지 100 유지 하기위한 jacoco 플러그인 추가 그리고 GitHub Actions 워크플로우에 요소 추가 Mar 10, 2025
@github-actions
Copy link

JaCoCo Test Coverage Report (100% Required)

Overall Project 100% 🍏
Files changed 100% 🍏

File Coverage
UserDetailInfoResponse.java 100% 🍏
ReviewMapper.java 100% 🍏
JudgmentResultMapper.java 100% 🍏
UserMapper.java 100% 🍏
UserService.java 100% 🍏

@zzoe2346 zzoe2346 changed the base branch from develop to main March 10, 2025 10:35
@zzoe2346 zzoe2346 merged commit 59b3ac1 into main Mar 10, 2025
2 checks passed
@zzoe2346 zzoe2346 linked an issue Mar 10, 2025 that may be closed by this pull request
@zzoe2346 zzoe2346 deleted the 32-커버리지-100-유지-하기위한-jacoco-플러그인-추가 branch March 10, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

커버리지 100% 유지 하기위한 Jacoco 플러그인 추가

2 participants