Skip to content

Add unit tests for the "Number of Employees Who Met the Target" problem. - #38

Merged
kobukuro merged 1 commit into
mainfrom
test/add-number-of-employees-who-met-the-target-tests
Jan 22, 2026
Merged

kobukuro merged 1 commit into
mainfrom
test/add-number-of-employees-who-met-the-target-tests

Conversation

@kobukuro

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 22, 2026 02:26

Copilot AI 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.

Pull request overview

This PR refactors the "Number of Employees Who Met the Target" solution by moving it from the root src/ directory into the proper package structure and adding comprehensive documentation and JUnit tests.

Changes:

  • Moved implementation from src/NumberOfEmployeesWhoMetTheTarget2798.java to src/main/java/com/leetcode/easy/NumberOfEmployeesWhoMetTheTarget2798.java with added Javadoc-style complexity analysis
  • Added JUnit test class NumberOfEmployeesWhoMetTheTarget2798Test.java with two test cases covering basic examples
  • Removed old implementation file with assertion-based main method

Reviewed changes

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

File Description
src/main/java/com/leetcode/easy/NumberOfEmployeesWhoMetTheTarget2798.java New implementation with proper package structure, added Tags comment and detailed time/space complexity documentation
src/test/java/com/leetcode/easy/NumberOfEmployeesWhoMetTheTarget2798Test.java New JUnit test class with BeforeEach setup and two test methods covering basic examples
src/NumberOfEmployeesWhoMetTheTarget2798.java Removed old implementation from root directory (code moved to proper package)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +34
@Test
void testNumberOfEmployeesWhoMetTarget_Example1() {
int[] hours = {0, 1, 2, 3, 4};
int target = 2;

int result = solution.numberOfEmployeesWhoMetTarget(hours, target);

assertEquals(3, result);
}

@Test
void testNumberOfEmployeesWhoMetTarget_Example2() {
int[] hours = {5, 1, 4, 2, 3};
int target = 6;

int result = solution.numberOfEmployeesWhoMetTarget(hours, target);

assertEquals(0, result);
}

Copilot AI Jan 22, 2026

Copy link

Choose a reason for hiding this comment

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

The test coverage is limited to basic examples. Consider adding tests for important edge cases such as:

  1. An empty array (if allowed by problem constraints)
  2. A single-element array where the element meets the target
  3. A single-element array where the element doesn't meet the target
  4. An array where all employees meet the target
  5. Boundary condition where hours exactly equal the target (already partially covered in Example1 but could be more explicit)

These additional tests would help ensure the solution handles all scenarios correctly.

Copilot uses AI. Check for mistakes.
@kobukuro
kobukuro merged commit 61123fa into main Jan 22, 2026
7 checks passed
@kobukuro
kobukuro deleted the test/add-number-of-employees-who-met-the-target-tests branch January 22, 2026 02:30
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