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

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

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

ObjectArrayAssert.as介绍

暂无

代码示例

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

@Test    //https://github.com/reactor/reactor-core/issues/1326
public void toArrayOnZeroQueueShouldNotFailAlsoOnJava9() {
  Queue<Integer> emptyQueue = Queues.<Integer>empty().get();
  assertThat(emptyQueue.toArray(new Integer[0])).as("toArray(empty)").isEmpty();
}

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

String extractedDescription = extractedDescriptionOf(propertiesOrFields);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(result).as(description);

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

@Test
public void zeroQueueOperations() {
  Queue<Integer> q = Queues.<Integer>empty().get();
  List<Integer> vals = Arrays.asList(1, 2, 3);
  assertThat(q.add(1)).as("add").isFalse();
  assertThat(q.addAll(vals)).as("addAll").isFalse();
  assertThat(q.offer(1)).as("offer").isFalse();
  assertThat(q.peek()).as("peek").isNull();
  assertThat(q.poll()).as("poll").isNull();
  assertThat(q.contains(1)).as("contains").isFalse();
  assertThat(q.iterator()).as("iterator").isEmpty();
  assertThatExceptionOfType(NoSuchElementException.class)
      .as("element")
      .isThrownBy(q::element);
  assertThatExceptionOfType(NoSuchElementException.class)
      .as("remove")
      .isThrownBy(q::remove);
  assertThat(q.remove(1)).as("remove").isFalse();
  assertThat(q.containsAll(vals)).as("containsAll").isFalse();
  assertThat(q.retainAll(vals)).as("retainAll").isFalse();
  assertThat(q.removeAll(vals)).as("removeAll").isFalse();
  assertThatCode(q::clear).as("clear").doesNotThrowAnyException();
  assertThat(q)
      .hasSize(0)
      .isEmpty();
  assertThat(q.toArray()).as("toArray").isEmpty();
  assertThat(q.toArray(new Integer[0])).as("toArray(empty)").isEmpty();
  Integer[] array = new Integer[]{-1, -2, -3};
  assertThat(q.toArray(array)).as("toArray(pre-filled)").containsExactly(null, -2, -3);
}

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

String extractedDescription = extractedDescriptionOf(propertiesOrFields);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(result).as(description);

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

String extractedDescription = extractedDescriptionOf(fieldOrProperty);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOf(fieldOrProperty);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOf(fieldOrProperty);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOf(fieldOrProperty);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

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

/**
 * Asserts that the tabs of the given {@code JTabbedPane} have the given titles. The tab titles are evaluated by index
 * order, for example, the first tab is expected to have the first title in the given array, and so on.
 *
 * @param tabbedPane the target {@code JTabbedPane}.
 * @param titles the expected titles.
 * @throws AssertionError if the title of any of the tabs is not equal to the expected titles.
 */
@RunsInEDT
public void requireTabTitles(@Nonnull JTabbedPane tabbedPane, @Nonnull String[] titles) {
 String[] actualTitles = allTabTitlesIn(tabbedPane);
 assertThat(actualTitles).as(propertyName(tabbedPane, "tabTitles")).isEqualTo(titles);
}

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

/**
 * Asserts that the {@code JOptionPane} has the given options.
 *
 * @param optionPane the target {@code JOptionPane}.
 * @param options the options to verify.
 * @throws AssertionError if the {@code JOptionPane} does not have the given options.
 */
@RunsInEDT
public void requireOptions(@Nonnull JOptionPane optionPane, @Nonnull Object[] options) {
 assertThat(optionsOf(optionPane)).as(propertyName(optionPane, OPTIONS_PROPERTY)).isEqualTo(options);
}

代码示例来源:origin: org.springframework.boot/spring-boot-test

/**
 * Obtain the beans names of the given type from the application context, the names
 * becoming the object array under test.
 * <p>
 * Example: <pre class="code">
 * assertThat(context).getBeanNames(Foo.class).containsOnly("fooBean"); </pre>
 * @param <T> the bean type
 * @param type the bean type
 * @return array assertions for the bean names
 * @throws AssertionError if the application context did not start
 */
public <T> AbstractObjectArrayAssert<?, String> getBeanNames(Class<T> type) {
  if (this.startupFailure != null) {
    throwAssertionError(contextFailedToStartWhenExpecting(
        "to get beans names with type:%n <%s>", type));
  }
  return Assertions.assertThat(getApplicationContext().getBeanNamesForType(type))
      .as("Bean names of type <%s> from <%s>", type, getApplicationContext());
}

代码示例来源:origin: io.syndesis.rest/rest-dao

.as("The scheme `%s` was resolved from a unexpected artifact", scheme).isEqualTo(coordinates);

代码示例来源:origin: org.apache.james/james-server-protocols-smtp

@Ignore
@Test
public void testEmptyMessageReceivedHeader() throws Exception {
  init(smtpConfiguration);
  SMTPClient smtp = newSMTPClient();
  // no message there, yet
  assertThat(queue.getLastMail())
    .as("no mail received by mail server")
    .isNull();;
  smtp.helo(InetAddress.getLocalHost().toString());
  smtp.setSender("mail@localhost");
  smtp.addRecipient("mail@localhost");
  smtp.sendShortMessageData("");
  smtp.quit();
  smtp.disconnect();
  assertThat(queue.getLastMail().getMessage().getHeader("Received"))
    .as("spooled mail has Received header")
    .isNotNull();
  // TODO: test body size
}

代码示例来源:origin: org.apache.james/james-server-protocols-smtp

@Test
public void testReceivedHeader() throws Exception {
  init(smtpConfiguration);
  SMTPClient smtp = newSMTPClient();
  // no message there, yet
  assertThat(queue.getLastMail())
    .as("no mail received by mail server")
    .isNull();;
  smtp.helo(InetAddress.getLocalHost().toString());
  smtp.setSender("mail@localhost");
  smtp.addRecipient("mail@localhost");
  smtp.sendShortMessageData("Subject: test\r\n\r\n");
  smtp.quit();
  smtp.disconnect();
  assertThat(queue.getLastMail().getMessage().getHeader("Received"))
    .as("spooled mail has Received header")
    .isNotNull();
}

相关文章