Skip to content

Commit

Permalink
feat(SubstringTest): testing out substring method
Browse files Browse the repository at this point in the history
  • Loading branch information
101zh committed Oct 3, 2023
1 parent c1dc08d commit dd11072
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/SubstringTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Assert;
import org.junit.Test;

public class SubstringTest {
@Test
public void zeroZeroTest(){
String a="a";
a=a.substring(0, 0);
assertTrue(a.equals(""));
}

@Test
public void lengthTest(){
String a = "012345";
String segment = "23";
int index = a.indexOf(segment);
a = a.substring(0, index)+a.substring(index+segment.length());
assertTrue(a.equals("0145"));

}
}

0 comments on commit dd11072

Please sign in to comment.