-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/textutils #136
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
AfagMamedova
wants to merge
5
commits into
fungover:main
Choose a base branch
from
AfagMamedova:feature/textutils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/textutils #136
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e3b4db2
Lade till TextUtils med metod för att räkna ord
AfagMamedova aa792fd
Lade till TextUtils med metod för att räkna ord
AfagMamedova 5c90816
Lade till TextUtils med metod för att räkna ord
AfagMamedova 76d2ce9
Lade till TextUtils med metod för att räkna ord
AfagMamedova 6d61feb
Lade till TextUtils med countWords-metod och tester
AfagMamedova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule breeze
added at
beeafc
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package utils; | ||
|
|
||
|
|
||
| public class TextUtils { | ||
| public static int countWords(String text) { | ||
| if (text == null || text.isBlank()) return 0; | ||
| return text.trim().split("\\s+").length; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package utils; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import static org.junit.jupiter.api.Assertions.*; | ||
|
|
||
| public class TextUtilsTest { | ||
|
|
||
| @Test | ||
| public void testCountWords_NormalSentence() { | ||
| String text = "Det här är en mening."; | ||
| int result = TextUtils.countWords(text); | ||
| assertEquals(5, result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCountWords_EmptyString() { | ||
| String text = ""; | ||
| int result = TextUtils.countWords(text); | ||
| assertEquals(0, result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCountWords_Null() { | ||
| int result = TextUtils.countWords(null); | ||
| assertEquals(0, result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testCountWords_ExtraSpaces() { | ||
| String text = " En mening med mellanrum "; | ||
| int result = TextUtils.countWords(text); | ||
| assertEquals(4, result); | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Be careful with the modified argLine configuration
The removal of
${argLine}from the Surefire plugin configuration might break code coverage reporting. When tools like JaCoCo are used, they typically inject their Java agent through theargLineproperty.🏁 Script executed:
Length of output: 1688
Ensure JaCoCo agent remains in Surefire’s argLine
The current Surefire configuration in pom.xml (around line 99) fully replaces the default
${argLine}:JaCoCo’s prepare-agent goal injects its
-javaagentvia${argLine}, so dropping it will break your code-coverage reports. To fix this, prepend the existing${argLine}when adding modules:<argLine>${argLine} --add-modules jdk.incubator.vector</argLine>– File: pom.xml (Surefire plugin configuration)
– Location: since you have a
jacoco-maven-pluginprepare-agent execution and a CI profile that uses it, be sure the${argLine}placeholder is preserved.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file shouldn't need to be altered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kappsegla You're right to question this. The pom.xml file doesn't need to be modified for adding the TextUtils functionality. The change to remove
${argLine}from the Surefire configuration is unrelated to the new utility class and its tests.In fact, removing
${argLine}could break code coverage reporting as JaCoCo injects its Java agent through this property. I recommend keeping the original configuration:Unless there's a specific reason for changing the build configuration, it's best to focus PR changes only on what's needed for the new feature.