• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CombinableMatcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hamcrest.core.CombinableMatcher的典型用法代码示例。如果您正苦于以下问题:Java CombinableMatcher类的具体用法?Java CombinableMatcher怎么用?Java CombinableMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CombinableMatcher类属于org.hamcrest.core包,在下文中一共展示了CombinableMatcher类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAssertThatHamcrestCoreMatchers

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void testAssertThatHamcrestCoreMatchers() {
    assertThat("good", allOf(equalTo("good"), startsWith("good")));
    assertThat("good", not(allOf(equalTo("bad"), equalTo("good"))));
    assertThat("good", anyOf(equalTo("bad"), equalTo("good")));
    assertThat(7, not(CombinableMatcher.either(equalTo(3)).or(equalTo(4))));
    assertThat(new Object(), not(sameInstance(new Object())));
}
 
开发者ID:ravidsrk,项目名称:android-testing-guide,代码行数:9,代码来源:AssertTests.java


示例2: testAssertThatHamcrestCoreMatchers

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void testAssertThatHamcrestCoreMatchers() {
    assertThat("good", allOf(equalTo("good"), startsWith("good")));
    assertThat("good", not(allOf(equalTo("bad"), equalTo("good"))));
    assertThat("good", anyOf(equalTo("bad"), equalTo("good")));
    assertThat(7, not(CombinableMatcher.<Integer> either(equalTo(3)).or(equalTo(4))));
    assertThat(new Object(), not(sameInstance(new Object())));
}
 
开发者ID:kousen,项目名称:Advanced_Java,代码行数:9,代码来源:AssertTests.java


示例3: testReallyLargeUpfrontAllocation

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void testReallyLargeUpfrontAllocation() {
  try {
    new UpfrontAllocatingPageSource(new OffHeapBufferSource(), Long.MAX_VALUE, MemoryUnit.GIGABYTES.toBytes(1));
    Assert.fail("Expected IllegalArgumentException");
  } catch (IllegalArgumentException e) {
    Assert.assertThat(e.getMessage(), CombinableMatcher.either(containsString("physical memory")).or(containsString("allocate more off-heap memory")));
  }
}
 
开发者ID:Terracotta-OSS,项目名称:offheap-store,代码行数:10,代码来源:UpfrontAllocatingPageSourceTest.java


示例4: testShortPeriodSampler

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void testShortPeriodSampler() throws InterruptedException {
  StatisticArchive<Integer> archive = new StatisticArchive<>(20);
  StatisticSampler<Integer> sampler = new StatisticSampler<>(100L, TimeUnit.MILLISECONDS, constant(GAUGE, 42), archive);
  try {
    sampler.start();
    TimeUnit.SECONDS.sleep(1);
    assertBy(1, TimeUnit.SECONDS, contentsOf(archive), hasSize(CombinableMatcher.both(greaterThan(10)).and(lessThan(20))));
  } finally {
    sampler.shutdown();
  }
}
 
开发者ID:Terracotta-OSS,项目名称:statistics,代码行数:13,代码来源:StatisticSamplerTest.java


示例5: testBothMatcher

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void testBothMatcher() throws Exception {
    Matcher<String> matcher = CombinableMatcher.both(equalTo("abc")).and(equalTo("bc"));

    assertDescription(matcher, "('abc' and 'bc')");
    assertMismatch("abc", matcher, "'bc' was 'abc'");
}
 
开发者ID:mistraltechnologies,项目名称:smog,代码行数:8,代码来源:SimpleMatcherExamplesTest.java


示例6: expect

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
/**
 * Adds {@code matcher} to the list of requirements for any thrown exception.
 */
// Should be able to remove this suppression in some brave new hamcrest world.
@SuppressWarnings("unchecked")
public void expect(Matcher<?> matcher) {
    if (this.matcher == null) {
        this.matcher = (Matcher<Object>) matcher;
    } else {
        this.matcher = CombinableMatcher.both(this.matcher).and((Matcher<Object>) matcher);
    }
}
 
开发者ID:michaelyaakoby,项目名称:testfun,代码行数:13,代码来源:ExpectedConstraintViolation.java


示例7: expectViolation

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
/**
 * Adds to the list of requirements for any thrown exception that it
 * should <em>contain</em> string {@code substring}
 */
public void expectViolation(String substring) {
    if (matcher == null) {
        expect(CombinableMatcher.either(
                new CausedBy(org.hibernate.exception.ConstraintViolationException.class))
                .or(new CausedBy(ConstraintViolationException.class)));
    }

    expectMessage(CoreMatchers.containsString(substring));
}
 
开发者ID:michaelyaakoby,项目名称:testfun,代码行数:14,代码来源:ExpectedConstraintViolation.java


示例8: windowsFileWithPassword

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void windowsFileWithPassword() {
    PdfFileSource result = new PdfFileSourceAdapter("/tmp/inputFile1.pdf:secret123").getPdfFileSource();
    assertThat(result.getPassword(), is("secret123"));
    assertThat(result.getSource(),
            CombinableMatcher.<File> either(is(new File("/tmp/inputFile1.pdf"))).or(
                    is(new File("c:\\tmp\\inputFile1.pdf"))));
}
 
开发者ID:torakiki,项目名称:sejda,代码行数:9,代码来源:PdfFileSourceAdapterTest.java


示例9: windowsFileNoPassword

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void windowsFileNoPassword() {
    PdfFileSource result = new PdfFileSourceAdapter("/tmp/inputFile1.pdf").getPdfFileSource();
    assertNull(result.getPassword());
    assertThat(result.getSource(),
            CombinableMatcher.<File> either(is(new File("/tmp/inputFile1.pdf"))).or(
                    is(new File("c:\\tmp\\inputFile1.pdf"))));
}
 
开发者ID:torakiki,项目名称:sejda,代码行数:9,代码来源:PdfFileSourceAdapterTest.java


示例10: protectedFileWithPasswordContainingSeparator

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
@Test
public void protectedFileWithPasswordContainingSeparator() {
    PdfFileSource result = new PdfFileSourceAdapter("/tmp/inputFile1.pdf:secret.pdf:password").getPdfFileSource();
    assertThat(result.getPassword(), is("secret.pdf:password"));
    assertThat(result.getSource(),
            CombinableMatcher.<File> either(is(new File("/tmp/inputFile1.pdf"))).or(
                    is(new File("c:\\tmp\\inputFile1.pdf"))));
}
 
开发者ID:torakiki,项目名称:sejda,代码行数:9,代码来源:PdfFileSourceAdapterTest.java


示例11: isThisTestSource

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
public static CombinableMatcher<? super IDataSourceConfiguration> isThisTestSource() {
  return both(hasName(equalTo(THIS_SOURCE_NAME)))//
      .and(hasUri(equalTo(THIS_SOURCE_URI)))
      .and(hasLanguages(containsInAnyOrder(EN, DE)))
      .and(hasRank(closeTo(THIS_SOURCE_RANK, TOLERANCE)));
}
 
开发者ID:eENVplus,项目名称:tf-exploitation-server,代码行数:7,代码来源:DataSourceConfigurationTestUtilities.java


示例12: isThatTestSource

import org.hamcrest.core.CombinableMatcher; //导入依赖的package包/类
public static CombinableMatcher<? super IDataSourceConfiguration> isThatTestSource() {
  return both(hasName(equalTo(THAT_SOURCE_NAME)))//
      .and(hasUri(equalTo(THAT_SOURCE_URI)))
      .and(hasLanguages(containsInAnyOrder(EN)))
      .and(hasRank(closeTo(THAT_SOURCE_RANK, TOLERANCE)));
}
 
开发者ID:eENVplus,项目名称:tf-exploitation-server,代码行数:7,代码来源:DataSourceConfigurationTestUtilities.java



注:本文中的org.hamcrest.core.CombinableMatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ASN1TaggedObjectParser类代码示例发布时间:2022-05-23
下一篇:
Java FSize类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap