SettingsHandler { @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Settings saveSettings(final Settings settings) { backendManager.saveSettings(settings); return settings; } @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 testSaveSettings() { BackendManager backendManager = createMock(BackendManager.class); Settings settings = new Settings("serverName"); backendManager.saveSettings(settings); expectLastCall().atLeastOnce(); replay(backendManager); SettingsHandler settingsHandler = new SettingsHandler(backendManager); settingsHandler.saveSettings(settings); verify(backendManager); }