### Question:
FeedbackManager { protected void openURL(String url) { URL aURL; try { aURL = URLEncodingUtilities.encodeURL(new URL(url)); BrowserUtilities.browse(aURL, myToolbox.getUIRegistry().getMainFrameProvider().get()); } catch (final MalformedURLException e) { JOptionPane.showMessageDialog(myToolbox.getUIRegistry().getMainFrameProvider().get(), "An error was encountered trying to create hyperlink", "Create Hyperlink Error", JOptionPane.ERROR_MESSAGE); } }  void addMenuItems(Toolbox toolbox, SplitButton button); static final String PROVIDE_FEEDBACK; static final String REPORT_BUG; static final String REQUEST_FEATURE; }### Answer:
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testOpenURL() throws MalformedURLException { SplitButton button = new SplitButton(null, null); Toolbox mockToolbox = createStrictMock(Toolbox.class); GeometryRegistry mockGeometryRegistry = createStrictMock(GeometryRegistry.class); RenderingCapabilities mockRenderingCapabilities = createStrictMock(RenderingCapabilities.class); PreferencesRegistry mockPreferencesRegistry = createStrictMock(PreferencesRegistry.class); Preferences mockPreferences = createStrictMock(Preferences.class); UIRegistry mockUIRegistry = createStrictMock(UIRegistry.class); Supplier mockSupplier = createStrictMock(Supplier.class); StatisticsManager mockStatisticsManager = createStrictMock(StatisticsManager.class); SystemStatistics systemStatistics = new SystemStatistics(); GraphicsStatistics graphicsStatistics = new GraphicsStatistics(); ApplicationStatistics applicationStatistics = new ApplicationStatistics(); SessionStatistics sessionStatistics = new SessionStatistics(); UserStatistics userStatistics = new UserStatistics(); expect(mockStatisticsManager.getSystemStatistics()).andReturn(systemStatistics).anyTimes(); expect(mockStatisticsManager.getGraphicsStatistics()).andReturn(graphicsStatistics).anyTimes(); expect(mockStatisticsManager.getApplicationStatistics()).andReturn(applicationStatistics).anyTimes(); expect(mockStatisticsManager.getSessionStatistics()).andReturn(sessionStatistics).anyTimes(); expect(mockStatisticsManager.getUserStatistics()).andReturn(userStatistics).anyTimes(); expect(mockToolbox.getPreferencesRegistry()).andReturn(mockPreferencesRegistry); expect(mockPreferencesRegistry.getPreferences(FeedbackManager.class)).andReturn(mockPreferences); expect(mockPreferences.getString(FeedbackManager.PROVIDE_FEEDBACK, null)).andReturn(null); expect(mockPreferences.getString(FeedbackManager.REPORT_BUG, null)).andReturn(null); expect(mockPreferences.getString(FeedbackManager.REQUEST_FEATURE, null)).andReturn(null); expect(mockUIRegistry.getMainFrameProvider()).andReturn(mockSupplier); expect(mockSupplier.get()).andReturn(null); expect(mockToolbox.getStatisticsManager()).andReturn(mockStatisticsManager).anyTimes(); expect(mockToolbox.getUIRegistry()).andReturn(mockUIRegistry); replay(mockToolbox, mockUIRegistry, mockSupplier, mockPreferencesRegistry, mockPreferences, mockGeometryRegistry, mockRenderingCapabilities, mockStatisticsManager); myTestObject.addMenuItems(mockToolbox, button); myTestObject.transmit("http: verify(mockToolbox, mockUIRegistry, mockSupplier, mockPreferencesRegistry, mockPreferences, mockGeometryRegistry, mockRenderingCapabilities); }