private void doRouterErrorCodeResolutionTest(LinkedHashMap<ServerErrorCode, RouterErrorCode> codesToSetAndTest)
      throws Exception {
    if (codesToSetAndTest.size() * 2 > serverCount) {
      throw new IllegalStateException("Cannot run test because there aren't enough servers for the given codes");
    }
    List<ServerErrorCode> serverErrorCodes = new ArrayList<>(Collections.nCopies(serverCount, ServerErrorCode.IOError));
    List<RouterErrorCode> expected = new ArrayList<>(codesToSetAndTest.size());
    // fill in the array with all the error codes that need resolution and knock them off one by one
    // has to be repeated because the op tracker returns failure if it sees 8/9 failures and the success target is 2
    int serverIdx = 0;
    for (Map.Entry<ServerErrorCode, RouterErrorCode> entry : codesToSetAndTest.entrySet()) {
      serverErrorCodes.set(serverIdx, entry.getKey());
      serverErrorCodes.set(serverIdx + 1, entry.getKey());
      expected.add(entry.getValue());
      serverIdx += 2;
    }
    expected.add(RouterErrorCode.UnexpectedInternalError);
    for (int i = 0; i < expected.size(); i++) {
      List<ServerErrorCode> shuffled = new ArrayList<>(serverErrorCodes);
      Collections.shuffle(shuffled);
      setServerErrorCodes(shuffled, serverLayout);
      executeOpAndVerify(blobIds, expected.get(i), false, true, true, false, false);
      if (i * 2 + 1 < serverErrorCodes.size()) {
        serverErrorCodes.set(i * 2, ServerErrorCode.IOError);
        serverErrorCodes.set(i * 2 + 1, ServerErrorCode.IOError);
      }
    }
    serverLayout.getMockServers().forEach(MockServer::resetServerErrors);
    assertTtl(router, blobIds, TTL_SECS);
  }
Runs the router code resolution test based on the input
@param codesToSetAndTest a {@link LinkedHashMap} that defines the ordering of the router error codes and also
                         provides the server error codes that must be set and their equivalent router error codes.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/TtlUpdateManagerTest.java