Skip to content

Commit

Permalink
CODEC-312: Add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Nov 24, 2023
1 parent 8fd0e33 commit 2e0bfe5
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.commons.codec.language;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -519,4 +520,34 @@ public final void testRemoveVowel_ALESSANDRA_Returns_ALSSNDR() {

// ***** END REGION - TEST GET MRA COMPARISONS

// ***** BEGIN REGION - TEST INVALID STRING *****

@Test
public final void testPunctuationOnly() {
assertDoesNotThrow(() -> {
String expected = "";
String result = this.getStringEncoder().encode(".,-");
assertEquals(result, expected);
});
}

@Test
public final void testVowelOnly() {
assertDoesNotThrow(() -> {
String expected = "A";
String result = this.getStringEncoder().encode("aeiouAEIOU");
assertEquals(result, expected);
});
}

@Test
public final void testVowelAndPunctuationOnly() {
assertDoesNotThrow(() -> {
String expected = "U";
String result = this.getStringEncoder().encode("uoiea.,-AEIOU");
assertEquals(result, expected);
});
}

// ***** END REGION - TEST INVALID STRING *****
}

0 comments on commit 2e0bfe5

Please sign in to comment.