LUCENE-6760: if the list of whitspace characters changes again in a future JVM, fail fast with a clear error that the test needs corrected -- even if jvm assertions are disabled OR we get really lucky with the chars radnomly selected

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1698227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2015-08-27 20:25:09 +00:00
parent fbd8608206
commit bb32ecb0fd
1 changed files with 13 additions and 0 deletions

View File

@ -385,6 +385,19 @@ public class ReturnFieldsTest extends SolrTestCaseJ4 {
'\u205F',
'\u3000',
};
static {
// if the JVM/unicode can redefine whitespace once (LUCENE-6760), it might happen again
// in the future. if that happens, fail early with a clera msg, even if java asserts
// (used in randomWhitespace) are disbled
for (int offset = 0; offset < WHITESPACE_CHARACTERS.length; offset++) {
char c = WHITESPACE_CHARACTERS[offset];
if (! Character.isWhitespace(c) ) {
fail(String.format(Locale.ENGLISH, "Not really whitespace? New JVM/Unicode definitions? WHITESPACE_CHARACTERS[%d] is '\\u%04X'", offset, (int) c));
}
}
}
/**
* Returns a random string in the specified length range consisting