mix up case in basetokenstreamtestcase, and avoid sun bug 6588260 in re-caser

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1326899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-17 03:38:45 +00:00
parent 167b296353
commit c034056ff2
2 changed files with 12 additions and 5 deletions

View File

@ -784,7 +784,15 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
sb.setLength(wordLength-1);
}
}
return sb.toString();
if (random.nextInt(17) == 0) {
// mix up case
String mixedUp = _TestUtil.randomlyRecaseCodePoints(random, sb.toString());
assert mixedUp.length() == sb.length();
return mixedUp;
} else {
return sb.toString();
}
}
protected String toDot(Analyzer a, String inputText) throws IOException {

View File

@ -446,11 +446,10 @@ public class _TestUtil {
while (pos < str.length()) {
int codePoint = str.codePointAt(pos);
pos += Character.charCount(codePoint);
String codePointSubstring = new String(new int[] { codePoint }, 0, 1);
switch (nextInt(random, 0, 2)) {
case 0: builder.append(codePointSubstring.toUpperCase(Locale.ENGLISH)); break;
case 1: builder.append(codePointSubstring.toLowerCase(Locale.ENGLISH)); break;
case 2: builder.append(codePointSubstring); // leave intact
case 0: builder.appendCodePoint(Character.toUpperCase(codePoint)); break;
case 1: builder.appendCodePoint(Character.toLowerCase(codePoint)); break;
case 2: builder.appendCodePoint(codePoint); // leave intact
}
}
return builder.toString();