SettingsHandler { @GET @Produces(APPLICATION_JSON) public Settings getSettings() { return backendManager.getSettings(); } @Inject  SettingsHandler(final BackendManager backendManager); @GET @Produces(APPLICATION_JSON) Settings getSettings(); @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Settings saveSettings(final Settings settings);  }
@Test public void testGetSettings() { BackendManager backendManager = createMock(BackendManager.class); expect(backendManager.getSettings()).andReturn(new Settings("serverName")).atLeastOnce(); replay(backendManager); SettingsHandler settingsHandler = new SettingsHandler(backendManager); assertNotNull(settingsHandler.getSettings()); verify(backendManager); }