org.assertj.core.api.ObjectArrayAssert.allMatch()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.assertj.core.api.ObjectArrayAssert.allMatch()方法的一些代码示例,展示了ObjectArrayAssert.allMatch()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectArrayAssert.allMatch()方法的具体详情如下:
包路径:org.assertj.core.api.ObjectArrayAssert
类名称:ObjectArrayAssert
方法名:allMatch

ObjectArrayAssert.allMatch介绍

暂无

代码示例

代码示例来源:origin: line/armeria

@Test(timeout = 10000)
public void testServiceHasMultipleClientRequests() throws Exception {
  assertThat(zipClient.hello("Lee")).isEqualTo("Hello, Lee!, and Hello, Lee!");
  final Span[] spans = spanReporter.take(6);
  final String traceId = spans[0].traceId();
  assertThat(spans).allMatch(s -> s.traceId().equals(traceId));
}

代码示例来源:origin: reactor/reactor-core

@Test
public void consumeWhileErrorIsSuppressed() {
  assertThatExceptionOfType(AssertionError.class)
      .isThrownBy(() -> StepVerifier.create(Flux.just("foo", "bar", "foobar")
              .map(r -> { if (r.length() > 3) throw new ArrayIndexOutOfBoundsException(); return r;}))
        .thenConsumeWhile(s -> s.length() <= 3) //doesn't fail by itself...
        .verifyComplete()) //...so this will fail
      .satisfies(error -> {
        assertThat(error)
            .hasMessageStartingWith("expectation \"expectComplete\" failed")
            .hasMessageContaining("actual: onError(java.lang.ArrayIndexOutOfBoundsException)");
        assertThat(error.getSuppressed())
            .hasSize(1)
            .allMatch(spr -> spr instanceof ArrayIndexOutOfBoundsException);
      });
}

代码示例来源:origin: line/armeria

assertThat(spans).allMatch(s -> s.traceId().equals(traceId));
assertThat(spans).allMatch(s -> "hello".equals(s.name()));

代码示例来源:origin: reactor/reactor-core

@Test
public void consumeNextErrorIsSuppressed() {
  assertThatExceptionOfType(AssertionError.class)
      .isThrownBy(() -> StepVerifier.create(Flux.just("foo")
      .flatMap(r -> { throw new ArrayIndexOutOfBoundsException();}))
        .consumeNextWith(v -> assertThat(v).isNotNull())
        .verifyError())
      .satisfies(error -> {
        assertThat(error)
            .hasMessageStartingWith("expectation \"consumeNextWith\" failed")
            .hasMessageContaining("actual: onError(java.lang.ArrayIndexOutOfBoundsException)");
        assertThat(error.getSuppressed())
            .hasSize(1)
            .allMatch(spr -> spr instanceof ArrayIndexOutOfBoundsException);
      });
}

代码示例来源:origin: reactor/reactor-core

@Test
public void expectNextSequenceErrorIsSuppressed() {
  assertThatExceptionOfType(AssertionError.class)
      .isThrownBy(() -> StepVerifier.create(Flux.just("foo")
      .flatMap(r -> { throw new ArrayIndexOutOfBoundsException();}))
        .expectNextSequence(Arrays.asList("foo"))
        .verifyError())
      .satisfies(error -> {
        assertThat(error)
            .hasMessageStartingWith("expectation \"expectNextSequence\" failed")
            .hasMessageContaining("actual signal: onError(java.lang.ArrayIndexOutOfBoundsException)");
        assertThat(error.getSuppressed())
            .hasSize(1)
            .allMatch(spr -> spr instanceof ArrayIndexOutOfBoundsException);
      });
}

代码示例来源:origin: line/armeria

assertThat(spans).allMatch(s -> s.traceId().equals(traceId));
assertThat(spans).allMatch(s -> "hello".equals(s.name()));

代码示例来源:origin: reactor/reactor-core

@Test
public void expectNextCountErrorIsSuppressed() {
  assertThatExceptionOfType(AssertionError.class)
      .isThrownBy(() -> StepVerifier.create(Flux.just("foo")
      .flatMap(r -> { throw new ArrayIndexOutOfBoundsException();}))
        .expectNextCount(1)
        .verifyError())
      .satisfies(error -> {
        assertThat(error)
            .hasMessageStartingWith("expectation \"expectNextCount(1)\" failed")
            .hasMessageContaining("signal: onError(java.lang.ArrayIndexOutOfBoundsException)");
        assertThat(error.getSuppressed())
            .hasSize(1)
            .allMatch(spr -> spr instanceof ArrayIndexOutOfBoundsException);
      });
}

代码示例来源:origin: reactor/reactor-core

@Test
public void expectNextErrorIsSuppressed() {
  assertThatExceptionOfType(AssertionError.class)
      .isThrownBy(() -> StepVerifier.create(Flux.just("foo")
                           .flatMap(r -> { throw new ArrayIndexOutOfBoundsException();}))
        .expectNext("foo")
        .verifyError())
      .satisfies(error -> {
        assertThat(error)
            .hasMessageStartingWith("expectation \"expectNext(foo)\" failed")
            .hasMessageContaining("actual: onError(java.lang.ArrayIndexOutOfBoundsException)");
        assertThat(error.getSuppressed())
            .hasSize(1)
            .allMatch(spr -> spr instanceof ArrayIndexOutOfBoundsException);
      });
}

相关文章