Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1528

replaceEachRepeatedly gives IllegalStateException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.8, 3.9, 3.8.1
    • 3.11
    • lang.*

    Description

       

      ChurchilllaanTest1 fails, ChurchilllaanTest2 doesn't, why?
      Please allow the ttl to be overridden.

          @Test
          public void ChurchilllaanTest1() {
              String input = "Churchilllaan";
              String[][] replaceMap = new String[][] {
                      { "llaan", "laan" },
              };
              
              String output = StringUtils.replaceEachRepeatedly(
                                               input, 
                                               getColumn(0, replaceMap),
                                               getColumn(1, replaceMap)); 
              Assert.assertEquals("Churchilaan", output);
          }
      
      @Test
          public void ChurchilllaanTest2() {
              String input = "Churchilllaan";
              String[][] replaceMap = new String[][] {
                      { "llaan", "laan" },
                      { "C", "c" },
              };
              
              String output = StringUtils.replaceEachRepeatedly(
                                               input, 
                                               getColumn(0, replaceMap),
                                               getColumn(1, replaceMap)); 
              Assert.assertEquals("churchilaan", output);
          }
      
        private String[] getColumn(int colIndex, String[][] from) {
              return Arrays.stream(from).map(x -> x[colIndex]).toArray(String[]::new);
          }
      
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yolofy jimmy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m