org.assertj.core.api.ListAssert.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(17.4k)|赞(0)|评价(0)|浏览(150)

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

ListAssert.<init>介绍

暂无

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Create a {@link AbstractListAssert}.
 * <p>
 * Implementations need to redefine either to be proxy friendly (i.e. no final assertion methods like {@link ProxyableListAssert})
 * or generic vararg friendly (to use {@link SafeVarargs} annotation which requires final method)like {@link ListAssert}.
 * <p>
 * The default implementation will assume that this concrete implementation is NOT a soft assertion.
 *
 * @param <E> the type of elements.
 * @param newActual new value
 * @return a new {@link AbstractListAssert}.
 */
protected <E> AbstractListAssert<?, List<? extends E>, E, ObjectAssert<E>> newListAssertInstance(List<? extends E> newActual) {
 return new ListAssert<>(newActual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Create a friendly soft or "hard" assertion.
 * <p>
 * Implementations need to redefine it so that some methods, such as {@link #extracting(Extractor)}, are able
 * to build the appropriate list assert (eg: {@link ListAssert} versus {@link ProxyableListAssert}).
 * <p>
 * The default implementation will assume that this concrete implementation is NOT a soft assertion.
 *
 * @param <E> the type of elements.
 * @param newActual new value
 * @return a new {@link AbstractListAssert}.
 */
@Override
protected <E> AbstractListAssert<?, List<? extends E>, E, ObjectAssert<E>> newListAssertInstance(List<? extends E> newActual) {
 return new ListAssert<>(newActual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code>.
 *
 * @param <T> the actual elements type
 * @param actual the actual value.
 * @return the created assertion object.
 */
public static <T> AbstractListAssert<?, List<? extends T>, T, ObjectAssert<T>> assertThat(List<? extends T> actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code>.
 *
 * @param <ELEMENT> the type of elements.
 * @param actual the actual value.
 * @return the created assertion object.
 */
public static <ELEMENT> ListAssert<ELEMENT> assertThat(List<? extends ELEMENT> actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Create a {@link AbstractListAssert}.
 * <p>
 * Implementations need to redefine either to be proxy friendly (i.e. no final assertion methods like {@link ProxyableListAssert})
 * or generic vararg friendly (to use {@link SafeVarargs} annotation which requires final method)like {@link ListAssert}.
 * <p>
 * The default implementation will assume that this concrete implementation is NOT a soft assertion.
 *
 * @param <E> the type of elements.
 * @param newActual new value
 * @return a new {@link AbstractListAssert}.
 */
protected <E> AbstractListAssert<?, List<? extends E>, E, ObjectAssert<E>> newListAssertInstance(List<? extends E> newActual) {
 return new ListAssert<>(newActual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Create a friendly soft or "hard" assertion.
 * <p>
 * Implementations need to redefine it so that some methods, such as {@link #extracting(Function)}, are able
 * to build the appropriate list assert (eg: {@link ListAssert} versus {@link ProxyableListAssert}).
 * <p>
 * The default implementation will assume that this concrete implementation is NOT a soft assertion.
 *
 * @param <E> the type of elements.
 * @param newActual new value
 * @return a new {@link AbstractListAssert}.
 */
@Override
protected <E> AbstractListAssert<?, List<? extends E>, E, ObjectAssert<E>> newListAssertInstance(List<? extends E> newActual) {
 return new ListAssert<>(newActual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link Stream}.
 * <p>
 * <b>Be aware that the {@code Stream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code Stream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link Stream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the Stream as it is converted to a List
 * assertThat(Stream.of(1, 2, 3)).contains(1)
 *                               .doesNotContain(42);</code></pre>
 * <p>
 * The following assertion fails as the Stream under test is converted to a List before being compared to the expected Stream:
 * <pre><code class='java'> // FAIL: the Stream under test is converted to a List and compared to a Stream but a List is not a Stream.
 * assertThat(Stream.of(1, 2, 3)).isEqualTo(Stream.of(1, 2, 3));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the Stream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the Stream to a List
 * Stream&lt;Integer&gt; stream = Stream.of(1, 2, 3);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param <ELEMENT> the type of elements.
 * @param actual the actual {@link Stream} value.
 * @return the created assertion object.
 */
public static <ELEMENT> ListAssert<ELEMENT> assertThat(Stream<? extends ELEMENT> actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link DoubleStream}.
 * <p>
 * <b>Be aware that the {@code DoubleStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code DoubleStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link DoubleStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the DoubleStream as it is converted to a List
 * assertThat(DoubleStream.of(1.0, 2.0, 3.0)).contains(1.0)
 *                                           .doesNotContain(42.0);</code></pre>
 * <p>
 * The following assertion fails as the DoubleStream under test is converted to a List before being compared to the expected DoubleStream:
 * <pre><code class='java'> // FAIL: the DoubleStream under test is converted to a List and compared to a DoubleStream but a List is not a DoubleStream.
 * assertThat(DoubleStream.of(1.0, 2.0, 3.0)).isEqualTo(DoubleStream.of(1.0, 2.0, 3.0));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the DoubleStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the DoubleStream to a List
 * DoubleStream stream = DoubleStream.of(1.0, 2.0, 3.0);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link DoubleStream} value.
 * @return the created assertion object.
 */
public static ListAssert<Double> assertThat(DoubleStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link IntStream}.
 * <p>
 * <b>Be aware that the {@code IntStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code IntStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link IntStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the IntStream as it is converted to a List
 * assertThat(IntStream.of(1, 2, 3)).contains(1)
 *                                  .doesNotContain(42);</code></pre>
 * <p>
 * The following assertion fails as the IntStream under test is converted to a List before being compared to the expected IntStream:
 * <pre><code class='java'> // FAIL: the IntStream under test is converted to a List and compared to a IntStream but a List is not a IntStream.
 * assertThat(IntStream.of(1, 2, 3)).isEqualTo(IntStream.of(1, 2, 3));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the IntStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the IntStream to a List
 * IntStream stream = IntStream.of(1, 2, 3);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link IntStream} value.
 * @return the created assertion object.
 */
public static ListAssert<Integer> assertThat(IntStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link LongStream}.
 * <p>
 * <b>Be aware that the {@code LongStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code LongStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link LongStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the LongStream as it is converted to a List
 * assertThat(LongStream.of(1, 2, 3)).contains(1)
 *                                   .doesNotContain(42);</code></pre>
 * <p>
 * The following assertion fails as the LongStream under test is converted to a List before being compared to the expected LongStream:
 * <pre><code class='java'> // FAIL: the LongStream under test is converted to a List and compared to a LongStream but a List is not a LongStream.
 * assertThat(LongStream.of(1, 2, 3)).isEqualTo(LongStream.of(1, 2, 3));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the LongStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the LongStream to a List
 * LongStream stream = LongStream.of(1, 2, 3);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link LongStream} value.
 * @return the created assertion object.
 */
public static ListAssert<Long> assertThat(LongStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code>.
 *
 * @param <T> the actual elements type
 * @param actual the actual value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static <T> AbstractListAssert<?, List<? extends T>, T, ObjectAssert<T>> assertThat(List<? extends T> actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code>.
 *
 * @param <ELEMENT> the type of elements.
 * @param actual the actual value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static <ELEMENT> ListAssert<ELEMENT> assertThat(List<? extends ELEMENT> actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

@Override
protected ListAssert<ELEMENT> newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable) {
 return new ListAssert<>(newArrayList(iterable));
}

代码示例来源:origin: joel-costigliola/assertj-core

@Override
protected ListAssert<ELEMENT> newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable) {
 return new ListAssert<>(newArrayList(iterable));
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link LongStream}.
 * <p>
 * <b>Be aware that the {@code LongStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code LongStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link LongStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the LongStream as it is converted to a List
 * assertThat(LongStream.of(1, 2, 3)).contains(1)
 *                                   .doesNotContain(42);</code></pre>
 * <p>
 * The following assertion fails as the LongStream under test is converted to a List before being compared to the expected LongStream:
 * <pre><code class='java'> // FAIL: the LongStream under test is converted to a List and compared to a LongStream but a List is not a LongStream.
 * assertThat(LongStream.of(1, 2, 3)).isEqualTo(LongStream.of(1, 2, 3));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the LongStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the LongStream to a List
 * LongStream stream = LongStream.of(1, 2, 3);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link LongStream} value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static ListAssert<Long> assertThat(LongStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link IntStream}.
 * <p>
 * <b>Be aware that the {@code IntStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code IntStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link IntStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the IntStream as it is converted to a List
 * assertThat(IntStream.of(1, 2, 3)).contains(1)
 *                                  .doesNotContain(42);</code></pre>
 * <p>
 * The following assertion fails as the IntStream under test is converted to a List before being compared to the expected IntStream:
 * <pre><code class='java'> // FAIL: the IntStream under test is converted to a List and compared to a IntStream but a List is not a IntStream.
 * assertThat(IntStream.of(1, 2, 3)).isEqualTo(IntStream.of(1, 2, 3));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the IntStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the IntStream to a List
 * IntStream stream = IntStream.of(1, 2, 3);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link IntStream} value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static ListAssert<Integer> assertThat(IntStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new instance of <code>{@link ListAssert}</code> from the given {@link DoubleStream}.
 * <p>
 * <b>Be aware that the {@code DoubleStream} under test will be converted to a {@code List} when an assertions require to inspect its content.
 * Once this is done the {@code DoubleStream} can't reused as it would have been consumed.</b>
 * <p>
 * Calling multiple methods on the returned {@link ListAssert} is safe as it only interacts with the {@link List} built from the {@link DoubleStream}.
 * <p>
 * Examples:
 * <pre><code class='java'> // you can chain multiple assertions on the DoubleStream as it is converted to a List
 * assertThat(DoubleStream.of(1.0, 2.0, 3.0)).contains(1.0)
 *                                           .doesNotContain(42.0);</code></pre>
 * <p>
 * The following assertion fails as the DoubleStream under test is converted to a List before being compared to the expected DoubleStream:
 * <pre><code class='java'> // FAIL: the DoubleStream under test is converted to a List and compared to a DoubleStream but a List is not a DoubleStream.
 * assertThat(DoubleStream.of(1.0, 2.0, 3.0)).isEqualTo(DoubleStream.of(1.0, 2.0, 3.0));</code></pre>
 * <p>
 * These assertions succeed as {@code isEqualTo} and {@code isSameAs} checks references which does not require to convert the DoubleStream to a List.
 * <pre><code class='java'> // The following assertions succeed as it only performs reference checking which does not require to convert the DoubleStream to a List
 * DoubleStream stream = DoubleStream.of(1.0, 2.0, 3.0);
 * assertThat(stream).isEqualTo(stream)
 *                   .isSameAs(stream);</code></pre>
 *
 * @param actual the actual {@link DoubleStream} value.
 * @return the created assertion object.
 */
@CheckReturnValue
public static ListAssert<Double> assertThat(DoubleStream actual) {
 return new ListAssert<>(actual);
}

代码示例来源:origin: org.assertj/assertj-core

return new ListAssert<>(actual);

代码示例来源:origin: facebook/litho

/**
 * Extract values from the underlying component based on the {@link Extractor} provided.
 * @param extractor The extractor applied to the Component.
 * @param <A> Type of the value extracted.
 * @return ListAssert for the extracted values.
 */
@CheckReturnValue
public <A> ListAssert<A> extracting(Extractor<Component, List<A>> extractor) {
 final List<A> value = extractor.extract(actual);
 return new ListAssert<>(value);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new instance of <code>{@link ListAssert}</code>.
 *
 * @param actual the actual value.
 * @return the created assertion object.
 */
public static <T> AbstractListAssert<?, ? extends List<? extends T>, T> assertThat(List<? extends T> actual) {
 return new ListAssert<T>(actual);
}

相关文章

微信公众号

最新文章

更多

ListAssert类方法