MkContainerTest.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:jcabi-http 作者:
/**
 * MkContainer can return certain answers for matching conditions.
 * @throws Exception If something goes wrong inside.
 */
@Test
public void answersConditionally() throws Exception {
    final String match = "matching";
    final String mismatch = "not matching";
    try (final MkContainer container = new MkGrizzlyContainer()) {
        container.next(
            new MkAnswer.Simple(mismatch),
            Matchers.not(new IsAnything<MkQuery>())
        ).next(new MkAnswer.Simple(match), new IsAnything<MkQuery>())
            .start();
        new JdkRequest(container.home())
            .through(VerboseWire.class)
            .fetch().as(RestResponse.class)
            .assertStatus(HttpURLConnection.HTTP_OK)
            .assertBody(
                Matchers.allOf(
                    Matchers.is(match),
                    Matchers.not(mismatch)
                )
            );
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号