LoginPresenter extends BasePresenter<LoginPresenter.ViewContract> implements Bundleable { @Override public void fromBundle(@Nullable Bundle bundle) { if(bundle != null) { username = bundle.getString("username"); password = bundle.getString("password"); } } @Inject  LoginPresenter(); void updateUsername(String username); void updatePassword(String password); void login(); @Override Bundle toBundle(); @Override void fromBundle(@Nullable Bundle bundle);  }
@Test public void fromBundle() throws Exception { loginPresenter.username = ""; loginPresenter.password = ""; Bundle bundle = BundleFactory.create(); Mockito.when(bundle.getString("username")).thenReturn("Hello"); Mockito.when(bundle.getString("password")).thenReturn("World"); loginPresenter.fromBundle(bundle); assertThat(loginPresenter.username).isEqualTo("Hello"); assertThat(loginPresenter.password).isEqualTo("World"); }