Added the code of Replace char in a string at specific index (#5869)
* Added the code of Replace char in a string at specific index * added test cases * Renamed the Test class name end with UnitTest * Renamed the Test class name end with UnitTest * Renamed the Test class name end with UnitTest * Replaced README with the upstream repo
This commit is contained in:
committed by
KevinGilmore
parent
6abaf50ab5
commit
547f99925f
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.string;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ReplaceCharInStringUnitTest {
|
||||
private ReplaceCharacterInString characterInString = new ReplaceCharacterInString();
|
||||
|
||||
@Test
|
||||
public void whenReplaceCharAtIndexUsingSubstring_thenSuccess(){
|
||||
assertEquals("abcme",characterInString.replaceCharSubstring("abcde",'m',3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReplaceCharAtIndexUsingStringBuilder_thenSuccess(){
|
||||
assertEquals("abcme",characterInString.replaceCharStringBuilder("abcde",'m',3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReplaceCharAtIndexUsingStringBuffer_thenSuccess(){
|
||||
assertEquals("abcme",characterInString.replaceCharStringBuffer("abcde",'m',3));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user