コード例 #1
0
  public void testProfileActivityLoadsCorrectData() throws Throwable {

    TestUtils.setupSocializeOverrides(true, true);
    Instrumentation.ActivityMonitor monitor =
        TestUtils.setUpActivityMonitor(this, ProfileActivity.class);

    final User dummy = new User();

    dummy.setId(69L);
    dummy.setFirstName("foo");
    dummy.setLastName("bar");

    SocializeUserUtils userUtils =
        new SocializeUserUtils() {
          @Override
          public void getUser(Context context, long id, UserGetListener listener) {
            listener.onGet(dummy);
          }

          @Override
          public User getCurrentUser(Context context) {
            return dummy;
          }
        };

    SocializeAccess.setUserUtilsProxy(userUtils);

    // Ensure facebook is enabled
    ConfigUtils.getConfig(getContext()).setFacebookAppId("1234567890");
    ConfigUtils.getConfig(getContext())
        .setTwitterKeySecret(
            "U18LUnVjULkkpGoJ6CoP3A", "RiIljnFq4RWV9LEaCM1ZLsAHf053vX2KyhJhmCOlBE");

    UserUtils.showUserSettings(TestUtils.getActivity(this));

    Activity waitForActivity = monitor.waitForActivityWithTimeout(5000);

    assertNotNull(waitForActivity);

    // Check that the user's name is displayed
    assertTrue(TestUtils.lookForText(waitForActivity, "foo", 10000));
    assertTrue(TestUtils.lookForText(waitForActivity, "bar", 10000));

    waitForActivity.finish();
  }
コード例 #2
0
 public MockSocializeSession() {
   super();
   user = new User();
   user.setId(-1L);
 }