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

x33g5p2x  于2022-01-20 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(91)

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

IterableAssert.withFailMessage介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-security

@Test
public void testNullDefaultAuthorities() {
  UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
      "user", "password");
  assertThat(jaasProvider.supports(UsernamePasswordAuthenticationToken.class)).isTrue();
  Authentication auth = jaasProvider.authenticate(token);
  assertThat(auth
      .getAuthorities()).withFailMessage("Only ROLE_TEST1 and ROLE_TEST2 should have been returned").hasSize(2);
}

代码示例来源:origin: org.apache.james/apache-mailet-base

@Test
public void testAllMatch() throws MessagingException {
  MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
    @Override
    public Collection<MailAddress> match(Mail mail) throws MessagingException {
      return null;
    }
  });
  FakeMail mail = FakeMail.builder()
      .recipient(new MailAddress("user", "domain"))
      .build();
  assertThat(inverter.match(mail)).withFailMessage("Should match all recipients").isNotNull();
}

代码示例来源:origin: org.apache.james/apache-mailet-base

@Test
public void testNonMatch() throws MessagingException {
  final MailAddress address1 = new MailAddress("user", "domain");
  final MailAddress address2 = new MailAddress("user", "domain2");
  MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
    @Override
    public Collection<MailAddress> match(Mail mail) throws MessagingException {
      return mail.getRecipients();
    }
  });
  FakeMail mail = FakeMail.builder()
      .recipients(address1, address2)
      .build();
  assertThat(inverter.match(mail)).withFailMessage("Should match all recipients").isNull();
}

相关文章

微信公众号

最新文章

更多