  @Test
  public void fallingbackUnsuccessfully() {

    JSBundleLoader delegates[] = new JSBundleLoader[] {
      recoverableLoader("url1", "error1"),
      recoverableLoader("url2", "error2")
    };

    FallbackJSBundleLoader fallbackLoader =
      new FallbackJSBundleLoader(new ArrayList<>(Arrays.asList(delegates)));

    try {
      fallbackLoader.loadScript(null);
      fail("expect throw");
    } catch (Exception e) {
      assertThat(e).isInstanceOf(RuntimeException.class);

      Throwable cause = e.getCause();
      ArrayList<String> msgs = new ArrayList<>();
      while (cause != null) {
        msgs.add(cause.getMessage());
        cause = cause.getCause();
      }

      assertThat(msgs).containsExactly(
        recoverableMsg("error1"),
        recoverableMsg("error2"));
    }

    verify(delegates[0], times(1)).loadScript(null);
    verify(delegates[1], times(1)).loadScript(null);

    assertThat(mLoggingDelegate.logContains(
        FakeLoggingDelegate.WTF,
        FallbackJSBundleLoader.TAG,
        recoverableMsg("error1")))
      .isTrue();

    assertThat(mLoggingDelegate.logContains(
        FakeLoggingDelegate.WTF,
        FallbackJSBundleLoader.TAG,
        recoverableMsg("error2")))
      .isTrue();
  }