test/tools/javac/util/StringUtilsTest.java

changeset 2415
7ceaee0e497b
parent 2413
fe033d997ddf
child 2525
2eb010b6cb22
     1.1 --- a/test/tools/javac/util/StringUtilsTest.java	Thu Dec 19 11:38:45 2013 -0500
     1.2 +++ b/test/tools/javac/util/StringUtilsTest.java	Thu May 29 10:48:00 2014 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,7 +23,7 @@
    1.11  
    1.12  /**
    1.13   * @test
    1.14 - * @bug 8029800
    1.15 + * @bug 8029800 8043186
    1.16   * @summary Unit test StringUtils
    1.17   * @run main StringUtilsTest
    1.18   */
    1.19 @@ -44,12 +44,14 @@
    1.20          assertEquals("\u0131", "I".toLowerCase());
    1.21          assertEquals("\u0130", "i".toUpperCase());
    1.22  
    1.23 -        //verify the StringUtils does what it should
    1.24 +        //verify the StringUtils.toLowerCase/toUpperCase do what they should:
    1.25          assertEquals("i", StringUtils.toLowerCase("I"));
    1.26          assertEquals("I", StringUtils.toUpperCase("i"));
    1.27  
    1.28 -        //verify we can use index from indexOf of toLowerCase String in the original:
    1.29 -        assertEquals(2, StringUtils.toLowerCase("\u0130\u0130lookFor").indexOf("lookfor"));
    1.30 +        //verify StringUtils.caseInsensitiveIndexOf works:
    1.31 +        assertEquals(2, StringUtils.indexOfIgnoreCase("  lookFor", "lookfor"));
    1.32 +        assertEquals(11, StringUtils.indexOfIgnoreCase("  lookFor  LOOKfor", "lookfor", 11));
    1.33 +        assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor"));
    1.34      }
    1.35  
    1.36      void assertEquals(String expected, String actual) {

mercurial