コード例 #1
0
 @Test
 public void replaceWordInSentence_replacePartialCatWithDog_true() {
   Findandreplace replace = new Findandreplace();
   String expValue = "I am walking my dog to the doghedral";
   assertEquals(
       expValue,
       replace.replaceWordInSentence("I am walking my cat to the cathedral", "cat", "dog"));
 }
コード例 #2
0
 @Test
 public void replaceWordInSentence_ignoreCase_true() {
   Findandreplace replace = new Findandreplace();
   String expValue = "I am walking my dog to the doghedral";
   assertEquals(
       expValue,
       replace.replaceWordInSentence("I am walking my cAt to the Cathedral", "cat", "dog"));
 }
コード例 #3
0
 @Test
 public void replaceWordInSentence_replaceDogWithCat_true() {
   Findandreplace replace = new Findandreplace();
   String expValue = "I have a pet cat";
   assertEquals(expValue, replace.replaceWordInSentence("I have a pet dog", "dog", "cat"));
 }