1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
42 |
42 |
43 //verify the properties of the default locale: |
43 //verify the properties of the default locale: |
44 assertEquals("\u0131", "I".toLowerCase()); |
44 assertEquals("\u0131", "I".toLowerCase()); |
45 assertEquals("\u0130", "i".toUpperCase()); |
45 assertEquals("\u0130", "i".toUpperCase()); |
46 |
46 |
47 //verify the StringUtils does what it should |
47 //verify the StringUtils.toLowerCase/toUpperCase do what they should: |
48 assertEquals("i", StringUtils.toLowerCase("I")); |
48 assertEquals("i", StringUtils.toLowerCase("I")); |
49 assertEquals("I", StringUtils.toUpperCase("i")); |
49 assertEquals("I", StringUtils.toUpperCase("i")); |
50 |
50 |
51 //verify we can use index from indexOf of toLowerCase String in the original: |
51 //verify StringUtils.caseInsensitiveIndexOf works: |
52 assertEquals(2, StringUtils.toLowerCase("\u0130\u0130lookFor").indexOf("lookfor")); |
52 assertEquals(2, StringUtils.indexOfIgnoreCase(" lookFor", "lookfor")); |
|
53 assertEquals(11, StringUtils.indexOfIgnoreCase(" lookFor LOOKfor", "lookfor", 11)); |
|
54 assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor")); |
53 } |
55 } |
54 |
56 |
55 void assertEquals(String expected, String actual) { |
57 void assertEquals(String expected, String actual) { |
56 if (!Objects.equals(expected, actual)) { |
58 if (!Objects.equals(expected, actual)) { |
57 throw new IllegalStateException("expected=" + expected + "; actual=" + actual); |
59 throw new IllegalStateException("expected=" + expected + "; actual=" + actual); |