* 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
24 lines
746 B
Java
24 lines
746 B
Java
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));
|
|
}
|
|
}
|