### Question:
OSGIResourceBundleFactory { public synchronized OSGIResourceBundle getBundle( ResourceBundle parent ) throws IOException { if ( previousResult == null || previousParent != parent ) { previousParent = parent; previousResult = new OSGIResourceBundle( defaultName, parent, propertyFileUrl ); } return previousResult; } OSGIResourceBundleFactory( String defaultName, String relativeName, URL propertyFileUrl, int priority ); synchronized OSGIResourceBundle getBundle( ResourceBundle parent ); int getPriority(); String getPropertyFilePath();  }### Answer:
@Test public void testGetBundle() throws IOException { String path = "i18n/resource/OSGIResourceBundleTest.properties"; OSGIResourceBundleFactory osgiResourceBundleFactory = new OSGIResourceBundleFactory( path, path, getClass().getClassLoader().getResource( path ), 10 ); assertEquals( path, osgiResourceBundleFactory.getPropertyFilePath() ); assertEquals( "testValue", osgiResourceBundleFactory.getBundle( null ).getString( "key" ) ); assertEquals( 10, osgiResourceBundleFactory.getPriority() ); }
@Test public void testGetBundleReturnsSameWithSameParent() throws IOException { String path = "i18n/resource/OSGIResourceBundleTest.properties"; ResourceBundle parent = mock( ResourceBundle.class ); OSGIResourceBundleFactory osgiResourceBundleFactory = new OSGIResourceBundleFactory( path, path, getClass().getClassLoader().getResource( path ), 10 ); assertTrue( osgiResourceBundleFactory.getBundle( parent ) == osgiResourceBundleFactory.getBundle( parent ) ); }
@Test public void testGetBundleReturnsDifferentWithDifferentParent() throws IOException { String path = "i18n/resource/OSGIResourceBundleTest.properties"; ResourceBundle parent = mock( ResourceBundle.class ); ResourceBundle parent2 = mock( ResourceBundle.class ); OSGIResourceBundleFactory osgiResourceBundleFactory = new OSGIResourceBundleFactory( path, path, getClass().getClassLoader().getResource( path ), 10 ); assertTrue( osgiResourceBundleFactory.getBundle( parent ) != osgiResourceBundleFactory.getBundle( parent2 ) ); }