Code example for MissingResourceException

0
 
		mockStatic(ResourceBundle.class);
		expect(ResourceBundle.getBundle("SomeBundleName", Locale.ENGLISH)).andReturn(bundle);
 
		final String key = "DUMMY";
		Exception e = new MissingResourceException(key, key, key);
		expect(bundle.getString(key)).andThrow(e);
 
		replayAll(); 
		instance.getResourceString(key);
	} 
 
	@Test(expected = MissingResourceException.class) 
	public final void testGetResourceStringWithBundleMissing() { 
 
		mockStatic(ResourceBundle.class);
		final String key = "DUMMY";
		Exception e = new MissingResourceException(key, key, key);
		expect(ResourceBundle.getBundle("SomeBundleName", Locale.ENGLISH)).andThrow(e);