Repository navigation
Add unit tests for the "Number of Employees Who Met the Target" problem. - #38
Merged
kobukuro merged 1 commit intoJan 22, 2026
Merged
Conversation
There was a problem hiding this comment.
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.javatosrc/main/java/com/leetcode/easy/NumberOfEmployeesWhoMetTheTarget2798.javawith added Javadoc-style complexity analysis - Added JUnit test class
NumberOfEmployeesWhoMetTheTarget2798Test.javawith 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); | ||
| } |
There was a problem hiding this comment.
The test coverage is limited to basic examples. Consider adding tests for important edge cases such as:
- An empty array (if allowed by problem constraints)
- A single-element array where the element meets the target
- A single-element array where the element doesn't meet the target
- An array where all employees meet the target
- 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.
kobukuro
deleted the
test/add-number-of-employees-who-met-the-target-tests
branch
January 22, 2026 02:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.