Code example for PropertyResourceBundle

0
 
	private SafeResourceBundle bundle;
 
	@Before 
	public void setUp() throws Exception {
		PropertyResourceBundle delegate = new PropertyResourceBundle(new ByteArrayInputStream("abc=def".getBytes()));
		bundle = new SafeResourceBundle(delegate);
	} 
 
	@Test
	public void shouldReturnDelegateValueWhenKeyExists() throws Exception {
		String result = bundle.getString("abc");
		assertThat(result, is("def"));
	} 
 
	@Test
	public void shouldReturnKeyBetweenQuestionMarksWhenKeyDoesntExist() throws Exception {
		String result = bundle.getString("any key");
		assertThat(result, is("???any key???"));
	} 
Experience pair programming with AI  Get Codota for Java