RegisterUserService { public FluentResponse register(User user) throws IOException { return fluentRequest .path("/api/register") .context(context) .param("user", user.asJSON()) .post(); } @Inject  RegisterUserService(RapidFtrApplication context, FluentRequest fluentRequest); FluentResponse register(User user);  }
@Test public void shouldRegisterUnverifiedUser() throws Exception { RapidFtrApplication mockContext = RapidFtrApplication.getApplicationInstance(); mockContext.getSharedPreferences().edit().putString(SERVER_URL_PREF, "whatever").commit(); FluentRequest mockFluentRequest = spy(new FluentRequest()); getFakeHttpLayer().addHttpResponseRule("POST", "http: new RegisterUserService(mockContext, mockFluentRequest).register(mock(User.class)); }