コード例 #1
0
  public void testSearchUser() {
    NetworkDataManager ndm = new NetworkDataManager();
    User user = new User();
    User user2;
    user.setName("Connor");
    user.setUserAddress("1021");
    user.setUserName("ccdunn");
    user.setUserEmail("*****@*****.**");
    user.addFriend("gbullock");

    ndm.saveUser(user);

    try {
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
    }

    assertTrue("Could not find the user", ndm.searchUser(user.getUserName()));

    assertFalse("Found a user that doesnt exist!", ndm.searchUser("NotExistingUser"));

    ndm.deleteUser(user.getUserName());

    try {
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
    }

    assertFalse("Still finding user that should be deleted...", ndm.searchUser(user.getUserName()));
  }
コード例 #2
0
  public void testRetrieveUser() {
    NetworkDataManager ndm = new NetworkDataManager();
    User user = new User();
    User user2;
    user.setName("Connor");
    user.setUserAddress("1021");
    user.setUserName("ccdunn");
    user.setUserEmail("*****@*****.**");
    user.addFriend("gbullock");

    ndm.saveUser(user);

    Log.i("NetworkDataManager", "Saved User!");

    try {
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
    }

    user2 = ndm.retrieveUser(user.getUserName());

    assertTrue("Users are not equal!!", user.equals(user2));

    Log.i("NetworkDataManager", "Users Equal!");
    // wait a decent amount of time to ensure the save has time to happen
    try {
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
    }

    ndm.deleteUser(user.getUserName());

    Log.i("NetworkDataManager", "Deleted User!");
  }
コード例 #3
0
  public void testDeleteUser() {
    NetworkDataManager ndm = new NetworkDataManager();
    User user = new User();
    user.setName("Garry");
    user.setUserAddress("4465");
    user.setUserName("gbullock");
    user.setUserEmail("*****@*****.**");

    ndm.saveUser(user);

    Log.i("NetworkDataManager", "Saved User!");

    // wait a decent amount of time to ensure the save has time to happen
    try {
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
    }

    ndm.deleteUser(user.getUserName());

    Log.i("NetworkDataManager", "Deleted User!");
  }