[ 
https://issues.apache.org/jira/browse/CODEC-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17952652#comment-17952652
 ] 

Gary D. Gregory edited comment on CODEC-332 at 5/19/25 3:14 PM:
----------------------------------------------------------------

Hello [~ilikeprogramming] 

The test provided is irrelevant because it tests the class' package-private 
internals and cannot cause whitespace to be used to compute values. The 
encoding code cleans its input.

If you think you found a bug, create a test that only use public or protected 
API.

See {{MatchRatingApproachEncoderTest.testCompareWithWhitespace()}}


was (Author: garydgregory):
Hello [~ilikeprogramming] 

The test provided is irrelevant because it tests the class' internals and 
cannot cause whitespace to be used to compute values. The encoding code cleans 
its input.

If you think you found a bug, create a test that only use public or protected 
API.

See {{MatchRatingApproachEncoderTest.testCompareWithWhitespace()}}

> removeVowels() incorrectly treating leading whitespace as the first character
> -----------------------------------------------------------------------------
>
>                 Key: CODEC-332
>                 URL: https://issues.apache.org/jira/browse/CODEC-332
>             Project: Commons Codec
>          Issue Type: Bug
>            Reporter: Steven Verrell
>            Priority: Major
>
> It appears that when the input contains leading whitespace, the 
> MatchRatingApproachEncoder.removeVowels(String) method incorrectly treats the 
> whitespace as the first character of the word.
>  
>  
> For example, removeVowels(" AIDAN") => " DN"
> The expected result should be "ADN". Is there miss a step like use ".trim()" 
> to remove whitespace from the input?
> I used the test code in "/src/test/java/org/apache/commons/codec/language
> /MatchRatingApproachEncoderTest.java" and made a minor change to trigger this 
> error.
>  
> The test code is as follows:
>  
> {code:java}
> @Test
> public final void testRemoveVowel__AIDAN_Returns_ADN() {
>     assertEquals("ADN", getStringEncoder().removeVowels("AIDAN")); // pass
> }
> @Test
> public final void testRemoveVowel__WithLeadingWhitespace_Returns_ADN() {
>     assertEquals("ADN", getStringEncoder().removeVowels(" AIDAN")); //fail
> }
> {code}
> The testRemoveVowel_{_}AIDAN_Returns_ADN{_} test passes successfully{_},{_} 
> while the \{_}testRemoveVowel{_}_WithLeadingWhitespace_Returns_ADN test fails 
> and returns " DN" instead of the expected "ADN".
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to