Java 类org.robolectric.util.Pair 实例源码

项目:Goalie_Android    文件:RESTRemindTest.java   
private synchronized Pair<Integer, RESTRemind.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTRemind.Listener listener = Mockito.spy(new RESTRemind.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
@Test
public void getUserInfo() throws Exception {
    String friendUsername = getValidFriendUsername();
    Pair<Integer, RESTGetUserInfo.Listener> pair = createAListener();

    RESTGetUserInfo sm = new RESTGetUserInfo(friendUsername);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    User user = UserHelper.getInstance().getAllContacts().get(friendUsername);
    assertNotNull(user);
    assertEquals(user.username, friendUsername);
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
@Test
public void onResponseValidValuesSaved() throws Exception {
    String friendUsername = getTestUsername();
    Pair<Integer, RESTGetUserInfo.Listener> pair = createAListener();

    RESTGetUserInfo sm = new RESTGetUserInfo(friendUsername);
    sm.setListener(pair.second);
    sm.onResponse("{\"lastPhotoModifiedTime\":123, \"bio\":\"bio\",\"reputation\":99,\"goals\":[]}");

    verify(pair.second).onSuccess();

    User user = UserHelper.getInstance().getAllContacts().get(friendUsername);
    assertNotNull(user);
    assertEquals(user.finishedGoals.size(), 0);
    assertEquals(user.bio, "bio");
    assertEquals(user.reputation, 99);
    assertEquals(user.lastPhotoModifiedTime, 123);
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
private synchronized Pair<Integer, RESTGetUserInfo.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTGetUserInfo.Listener listener = Mockito.spy(new RESTGetUserInfo.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTUpvoteTest.java   
private synchronized Pair<Integer, RESTUpvote.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTUpvote.Listener listener = Mockito.spy(new RESTUpvote.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTSyncTest.java   
@Test()
public void onResponseBasic() throws Exception {
    final Pair<Integer, RESTSync.Listener> pair = createAListener();

    RESTSync sm2 = new RESTSync(username, PreferenceHelper.getInstance().getLastSyncedTimeEpoch());
    sm2.setListener(pair.second);
    sm2.onResponse("{\"feed\":[], \"my\":[],\"referee\":[],\"info\":{\"reputation\":999},\"time\":123}");

    verify(pair.second).onSuccess();
    assertEquals(UserHelper.getInstance().getOwnerProfile().reputation, 999);
    assertEquals(UserHelper.getInstance().getOwnerProfile().activeGoals.size(), 0);
    assertEquals(UserHelper.getInstance().getOwnerProfile().finishedGoals.size(), 0);
    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
    assertEquals(GoalHelper.getInstance().getFeeds().size(), 0);
    assertEquals(PreferenceHelper.getInstance().getLastSyncedTimeEpoch(), 123);
}
项目:Goalie_Android    文件:RESTSyncTest.java   
private synchronized Pair<Integer, RESTSync.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTSync.Listener listener = Mockito.spy(new RESTSync.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTNewGoalTest.java   
@Test
public void onResponseEmpty() throws Exception {
    String friendUsername = getTestUsername();
    User user = UserHelper.getInstance().getAllContacts().get(friendUsername);
    assertNull(user);

    Pair<Integer, RESTNewGoal.Listener> pair = createAListener();
    int currentActivitySize = UserHelper.getInstance().getOwnerProfile().activeGoals.size();

    RESTNewGoal sm = new RESTNewGoal(username, "title", 12000, 120000, 55, "encouragement", friendUsername, true);
    sm.setListener(pair.second);
    sm.onResponse("");

    verify(pair.second).onSuccess();

    User friendUser = UserHelper.getInstance().getAllContacts().get(friendUsername);
    assertNotNull(friendUser);

    User owner = UserHelper.getInstance().getAllContacts().get(username);
    assertNotNull(owner);
    assertEquals(owner.activeGoals.size(), currentActivitySize + 1);
}
项目:Goalie_Android    文件:RESTNewGoalTest.java   
private synchronized Pair<Integer, RESTNewGoal.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTNewGoal.Listener listener = Mockito.spy(new RESTNewGoal.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTUpdateUserInfoTest.java   
@Test
public void updatePushID() throws Exception {
    Pair<Integer, RESTUpdateUserInfo.Listener> pair = createAListener();

    final String newPushID = "pushID";
    RESTUpdateUserInfo restUpdateMeta = new RESTUpdateUserInfo(username, "", newPushID);
    restUpdateMeta.setListener(pair.second);
    restUpdateMeta.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertTrue(newPushID.equals(PreferenceHelper.getInstance().getPushID()));
}
项目:Goalie_Android    文件:RESTUpdateUserInfoTest.java   
@Test
public void updateBio() throws Exception {
    Pair<Integer, RESTUpdateUserInfo.Listener> pair = createAListener();

    final String bio = "new bio";
    RESTUpdateUserInfo restUpdateMeta = new RESTUpdateUserInfo(username, bio, "pushID");
    restUpdateMeta.setListener(pair.second);
    restUpdateMeta.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertTrue(UserHelper.getInstance().getOwnerProfile().bio.equals(bio));
}
项目:Goalie_Android    文件:RESTUpdateUserInfoTest.java   
@Test
public void updateFailed() throws Exception {
    Pair<Integer, RESTUpdateUserInfo.Listener> pair = createAListener();

    // update with invalid username
    String bio = "bio";
    String pushID = "pushID";
    RESTUpdateUserInfo restUpdateMeta = new RESTUpdateUserInfo("", bio, pushID);
    restUpdateMeta.setListener(pair.second);
    restUpdateMeta.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onFailure("Unauthorized, Please Update App");
    assertFalse(UserHelper.getInstance().getOwnerProfile().bio.equals(bio));
    assertFalse(pushID.equals(PreferenceHelper.getInstance().getPushID()));
}
项目:Goalie_Android    文件:RESTUpdateUserInfoTest.java   
private synchronized Pair<Integer, RESTUpdateUserInfo.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTUpdateUserInfo.Listener listener = Mockito.spy(new RESTUpdateUserInfo.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTRegisterTest.java   
@Test
public void executeWithoutPushIDWithPushIDSaved() throws Exception {
    Pair<Integer, RESTRegister.Listener> pair = createAListener();

    PreferenceHelper.getInstance().setPushID("newPushID");
    RESTRegister rest = new RESTRegister(UUID.randomUUID().toString(), "");
    rest.setListener(pair.second);
    rest.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertTrue(!PreferenceHelper.getInstance().getPushID().isEmpty());
    assertFalse(RESTRegister.isRegistering());
}
项目:Goalie_Android    文件:RESTRegisterTest.java   
@Test
public void executeWithPushID() throws Exception {
    Pair<Integer, RESTRegister.Listener> pair = createAListener();

    assertFalse(RESTRegister.isRegistering());
    RESTRegister rest = new RESTRegister(UUID.randomUUID().toString(), "pushID");
    rest.setListener(pair.second);
    rest.execute();
    assertTrue(RESTRegister.isRegistering());

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertFalse(RESTRegister.isRegistering());
}
项目:Goalie_Android    文件:RESTRegisterTest.java   
private synchronized Pair<Integer, RESTRegister.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTRegister.Listener listener = Mockito.spy(new RESTRegister.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTPhotoTest.java   
private synchronized Pair<Integer, RESTGetPhoto.Listener> createDownloadListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTGetPhoto.Listener listener = Mockito.spy(new RESTGetPhoto.Listener() {
        @Override
        public void onSuccess(Bitmap image) {
            imageDownloaded = image;
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTPhotoTest.java   
private synchronized Pair<Integer, RESTUploadPhoto.Listener> createUploadListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTUploadPhoto.Listener listener = Mockito.spy(new RESTUploadPhoto.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:Goalie_Android    文件:RESTUpdateGoalTest.java   
@Test()
public void acceptGoal() throws Exception {
    final Pair<Integer, RESTUpdateGoal.Listener> pair = createAListener();

    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
    setupGoal();
    assertEquals(GoalHelper.getInstance().getRequests().size(), 1);
    RESTUpdateGoal sm = new RESTUpdateGoal(username, GoalHelper.getInstance().getRequests().get(0).guid,
            Goal.GoalCompleteResult.Ongoing);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertEquals(GoalHelper.getInstance().getRequests().get(0).goalCompleteResult, Goal.GoalCompleteResult.Ongoing);
}
项目:Goalie_Android    文件:RESTUpdateGoalTest.java   
@Test()
public void passGoal() throws Exception {
    final Pair<Integer, RESTUpdateGoal.Listener> pair = createAListener();

    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
    setupGoal();
    assertEquals(GoalHelper.getInstance().getRequests().size(), 1);
    RESTUpdateGoal sm = new RESTUpdateGoal(username, GoalHelper.getInstance().getRequests().get(0).guid,
            Goal.GoalCompleteResult.Success);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
}
项目:Goalie_Android    文件:RESTUpdateGoalTest.java   
@Test()
public void failGoal() throws Exception {
    final Pair<Integer, RESTUpdateGoal.Listener> pair = createAListener();

    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
    setupGoal();
    assertEquals(GoalHelper.getInstance().getRequests().size(), 1);
    RESTUpdateGoal sm = new RESTUpdateGoal(username, GoalHelper.getInstance().getRequests().get(0).guid,
            Goal.GoalCompleteResult.Failed);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertEquals(GoalHelper.getInstance().getRequests().size(), 0);
}
项目:Goalie_Android    文件:RESTUpdateGoalTest.java   
private synchronized Pair<Integer, RESTUpdateGoal.Listener> createAListener() {
    final Integer index = isOperationCompleteList.size();
    isOperationCompleteList.add(false);

    RESTUpdateGoal.Listener listener = Mockito.spy(new RESTUpdateGoal.Listener() {
        @Override
        public void onSuccess() {
            isOperationCompleteList.set(index, true);
        }

        @Override
        public void onFailure(String errMsg) {
            isOperationCompleteList.set(index, true);
        }
    });

    return new Pair<>(index, listener);
}
项目:android-perftracking    文件:MeasurementSpec.java   
@ParameterizedRobolectricTestRunner.Parameters(name = "Action = {0}, Input = {1}")
public static Collection<Object[]> data() {
  return Arrays.asList(new Object[][]{
      {Action.START, null},
      {Action.START, ""},
      {Action.START, "appQ\\"},
      {Action.START, "appQ\""},
      {Action.END, null},
      {Action.END, ""},
      {Action.END, "appQ\\"},
      {Action.END, "appQ\""},
      {Action.START_AGGREGATED, Pair.create(null, null)},
      {Action.START_AGGREGATED, Pair.create("", null)},
      {Action.START_AGGREGATED, Pair.create("valid", null)},
      {Action.START_AGGREGATED, Pair.create("appQ\\", null)},
      {Action.START_AGGREGATED, Pair.create("appQ\"", null)},
      {Action.START_AGGREGATED, Pair.create("appQ\\", "Object")},
      {Action.START_AGGREGATED, Pair.create("appQ\"", "Object")},
      {Action.END_AGGREGATED, Pair.create(null, null)},
      {Action.END_AGGREGATED, Pair.create("", null)},
      {Action.END_AGGREGATED, Pair.create("valid", null)},
      {Action.END_AGGREGATED, Pair.create("appQ\\", null)},
      {Action.END_AGGREGATED, Pair.create("appQ\"", null)},
      {Action.END_AGGREGATED, Pair.create("appQ\\", "Object")},
      {Action.END_AGGREGATED, Pair.create("appQ\"", "Object")}

  });
}
项目:android-perftracking    文件:MeasurementSpec.java   
public InvalidInputSpec(Action action, Object input) {
  if (input instanceof Pair) {
    this.input1 = (String) ((Pair) input).first;
    this.input2 = (Comparable) ((Pair) input).second;
  } else {
    this.input1 = (String) input;
  }
  this.action = action;
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
@Test
public void onResponseEmpty() throws Exception {
    String friendUsername = getValidFriendUsername();
    Pair<Integer, RESTGetUserInfo.Listener> pair = createAListener();

    RESTGetUserInfo sm = new RESTGetUserInfo(friendUsername);
    sm.setListener(pair.second);
    sm.onResponse("");

    verify(pair.second).onFailure(FAILED);
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
@Test
public void onResponseMissingFields() throws Exception {
    String friendUsername = getValidFriendUsername();
    Pair<Integer, RESTGetUserInfo.Listener> pair = createAListener();

    RESTGetUserInfo sm = new RESTGetUserInfo(friendUsername);
    sm.setListener(pair.second);
    sm.onResponse("{\"lastPhotoModifiedTime\":123, \"bio\":\"bio\",\"reputation\":99,\"missing\":[]}");

    verify(pair.second).onFailure(FAILED);
}
项目:Goalie_Android    文件:RESTGetUserInfoTest.java   
@Test
public void onResponseInvalidFields() throws Exception {
    String friendUsername = getValidFriendUsername();
    Pair<Integer, RESTGetUserInfo.Listener> pair = createAListener();

    RESTGetUserInfo sm = new RESTGetUserInfo(friendUsername);
    sm.setListener(pair.second);
    sm.onResponse("{\"lastPhotoModifiedTime\":123, \"bio\":\"bio\",\"reputation\":99,\"goals\":invalid}");

    verify(pair.second).onFailure(FAILED);
}
项目:Goalie_Android    文件:RESTSyncTest.java   
@Test()
public void sync() throws Exception {
    final Pair<Integer, RESTSync.Listener> pair = createAListener();

    RESTNewGoal sm = new RESTNewGoal(username, "title", 12000, 120000, 55, "encouragement", username, true);
    sm.setListener(new RESTNewGoal.Listener() {
        @Override
        public void onSuccess() {
            assertEquals(GoalHelper.getInstance().getFeeds().size(), 0);
            RESTSync sm2 = new RESTSync(username, PreferenceHelper.getInstance().getLastSyncedTimeEpoch());
            sm2.setListener(pair.second);
            sm2.execute();
        }

        @Override
        public void onFailure(String errMsg) {
            assertTrue(false);
        }
    });
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertNotEquals(PreferenceHelper.getInstance().getLastSyncedTimeEpoch(), 0);

    assertEquals(GoalHelper.getInstance().getRequests().size(), 1);
    assertEquals(UserHelper.getInstance().getOwnerProfile().activeGoals.size(), 1);
    assertEquals(UserHelper.getInstance().getOwnerProfile().finishedGoals.size(), 0);
}
项目:Goalie_Android    文件:RESTSyncTest.java   
@Test()
public void onResponseEmpty() throws Exception {
    final Pair<Integer, RESTSync.Listener> pair = createAListener();

    RESTSync sm2 = new RESTSync(username, PreferenceHelper.getInstance().getLastSyncedTimeEpoch());
    sm2.setListener(pair.second);
    sm2.onResponse("");

    verify(pair.second).onFailure(FAILED);
}
项目:Goalie_Android    文件:RESTSyncTest.java   
@Test()
public void onResponseInvalid() throws Exception {
    final Pair<Integer, RESTSync.Listener> pair = createAListener();

    RESTSync sm2 = new RESTSync(username, PreferenceHelper.getInstance().getLastSyncedTimeEpoch());
    sm2.setListener(pair.second);
    sm2.onResponse("{\"feed\":[], \"my\":[],\"referee\":[],\"info\":{\"reputation\":999},\"time\":\"invalid\"}");

    verify(pair.second).onFailure(FAILED);
}
项目:Goalie_Android    文件:RESTNewGoalTest.java   
@Test
public void setNewGoal() throws Exception {
    String friendUsername = getValidFriendUsername();
    Pair<Integer, RESTNewGoal.Listener> pair = createAListener();

    Object[] array = UserHelper.getInstance().getOwnerProfile().activeGoals.values().toArray();
    int currentActivitySize = array.length;
    RESTNewGoal sm = new RESTNewGoal(username, "title", 12000, 120000, 55, "encouragement", friendUsername, true);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();

    User user = UserHelper.getInstance().getAllContacts().get(username);
    assertNotNull(user);
    assertEquals(user.username, username);
    assertEquals(user.activeGoals.size(), currentActivitySize + 1);

    array = UserHelper.getInstance().getOwnerProfile().activeGoals.values().toArray();
    Goal goal = (Goal)array[currentActivitySize];
    assertEquals(goal.createdByUsername, username);
    assertEquals(goal.title, "title");
    assertEquals(goal.startDate, 12000);
    assertEquals(goal.endDate, 120000);
    assertEquals(goal.wager, 55);
    assertEquals(goal.encouragement, "encouragement");
    assertEquals(goal.referee, friendUsername);
    assertEquals(goal.goalCompleteResult, Goal.GoalCompleteResult.Pending);
    assertEquals(UserHelper.getInstance().getOwnerProfile().reputation, 45);
}
项目:Goalie_Android    文件:RESTRegisterTest.java   
@Test
public void executeWithoutPushIDWithoutPushIDSaved() throws Exception {
    Pair<Integer, RESTRegister.Listener> pair = createAListener();

    RESTRegister rest = new RESTRegister(UUID.randomUUID().toString(), "");
    rest.setListener(pair.second);
    rest.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
    assertFalse(!PreferenceHelper.getInstance().getPushID().isEmpty());
}
项目:Goalie_Android    文件:RESTPhotoTest.java   
private void downloadPhotoNotFound(String username) throws Exception {
    Pair<Integer, RESTGetPhoto.Listener> pair = createDownloadListener();

    RESTGetPhoto sm = new RESTGetPhoto(username);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onFailure("Not Found");
}
项目:Goalie_Android    文件:RESTPhotoTest.java   
private boolean downloadPhoto(String username) throws Exception {
    Pair<Integer, RESTGetPhoto.Listener> pair = createDownloadListener();

    RESTGetPhoto sm = new RESTGetPhoto(username);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess(imageDownloaded);
    return imageDownloaded != null;
}
项目:Goalie_Android    文件:RESTPhotoTest.java   
private void uploadPhoto(String username) throws Exception {
    Pair<Integer, RESTUploadPhoto.Listener> pair = createUploadListener();

    Bitmap bitmap = BitmapFactory.decodeFile("../test.png");
    RESTUploadPhoto sm = new RESTUploadPhoto(bitmap, username);
    sm.setListener(pair.second);
    sm.execute();

    while (!isOperationCompleteList.get(pair.first)) {
        Thread.sleep(1000);
    }

    verify(pair.second).onSuccess();
}
项目:FullRobolectricTestSample    文件:RobolectricTestRunner.java   
public final ResourceLoader getAppResourceLoader(SdkConfig sdkConfig, ResourceLoader systemResourceLoader, final AndroidManifest appManifest) {
  Pair<AndroidManifest, SdkConfig> androidManifestSdkConfigPair = new Pair<AndroidManifest, SdkConfig>(appManifest, sdkConfig);
  ResourceLoader resourceLoader = resourceLoadersByManifestAndConfig.get(androidManifestSdkConfigPair);
  if (resourceLoader == null) {
    resourceLoader = createAppResourceLoader(systemResourceLoader, appManifest);
    resourceLoadersByManifestAndConfig.put(androidManifestSdkConfigPair, resourceLoader);
  }
  return resourceLoader;
}