AbstractResourceBundle extends ResourceBundle { @Override public Enumeration<String> getKeys() { return this.bundle.keys(); } AbstractResourceBundle(); String getKey(Object object); @Override Enumeration<String> getKeys(); @Override boolean containsKey(String key); @Override Set<String> keySet();  }
@Test public void testKeys() { String[] expectedKeys = new String[] { "ERR_TEST", "MSG_TEST", "XYZ_TEST" }; MyBundle myRB = new MyBundle(); Set<String> expectedKeySet = new HashSet<String>(expectedKeys.length); for (String key : expectedKeys) { expectedKeySet.add(key); assertEquals(key + ".value", myRB.getString(key)); } Enumeration<String> keys = myRB.getKeys(); int count = 0; while (keys.hasMoreElements()) { String key = keys.nextElement(); assertTrue(expectedKeySet.contains(key)); count++; } assertEquals(count, expectedKeySet.size()); }