// Test containsKey() for (String key : fullKeys) { if (!rb.containsKey(key)) { thrownew RuntimeException("rb doesn't contain: " + key);
}
} for (String key : new String[] { "snack", "beer" }) { if (rb.containsKey(key)) { thrownew RuntimeException("rb contains: " + key);
}
}
// Make sure that the default handleKeySet implementation // returns the subset keys of the given locale.
TestBundle tb = new TestBundle(bundleName, locale);
Set<String> childKeys = tb.handleKeySet(); if (!(childKeys.containsAll(localKeys) || localKeys.containsAll(childKeys))) { thrownew RuntimeException("get " + childKeys + ", expected " + localKeys);
}
}
staticclass TestBundle extends ResourceBundle {
ResourceBundle bundle;
Method m;
public TestBundle() {}
public TestBundle(String name, Locale locale) {
bundle = ResourceBundle.getBundle(name, locale);
// Prepare for the handleGetObject call try { Class clazz = bundle.getClass();
m = clazz.getMethod("handleGetObject", String.class);
m.setAccessible(true);
} catch (Exception e) { thrownew RuntimeException("method preparation error", e);
}
}
public Enumeration<String> getKeys() { return bundle.getKeys();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.