tests: fix test bugs

This commit is contained in:
Robert Muir 2015-06-30 00:16:39 -04:00
parent 0bb65f710e
commit 4059d7c18d
1 changed files with 4 additions and 1 deletions

View File

@ -184,7 +184,10 @@ public class SecurityTests extends ElasticsearchTestCase {
public void testUnsafeAccess() throws Exception {
assumeTrue("test requires security manager", System.getSecurityManager() != null);
try {
Class.forName("sun.misc.Unsafe");
// class could be legitimately loaded, so we might not fail until setAccessible
Class.forName("sun.misc.Unsafe")
.getDeclaredField("theUnsafe")
.setAccessible(true);
fail("didn't get expected exception");
} catch (SecurityException expected) {
// ok