当前位置: 首页>>代码示例>>Java>>正文


Java XhtmlMatchers类代码示例

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


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

示例1: rendersHomePage

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
/**
 * App can render front page.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePage() throws Exception {
    final Take take = new TkApp(new FakeBase());
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                take.act(
                    new RqWithHeader(
                        new RqFake("GET", "/"),
                        // @checkstyle MultipleStringLiteralsCheck (1 line)
                        "Accept",
                        "text/xml"
                    )
                )
            ).printBody()
        ),
        XhtmlMatchers.hasXPaths(
            "/page/@date",
            "/page/@sla",
            "/page/millis",
            "/page/links/link[@rel='self']"
        )
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:29,代码来源:TkAppTest.java

示例2: rendersHomePage

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void rendersHomePage() throws Exception {
    final Take take = new TkApp(new FkBase());
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                take.act(
                    new RqWithHeaders(
                        new RqFake("GET", "/"),
                        "Accept: text/xml"
                    )
                )
            ).printBody()
        ),
        XhtmlMatchers.hasXPaths(
            "/page/@date",
            "/page/@sla",
            "/page/millis",
            "/page/links/link[@rel='self']"
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:23,代码来源:TkAppTest.java

示例3: createsXml

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void createsXml() throws IOException {
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new Skeleton(
                new FakeBase("OverloadMethods", "Bar")
            ).xml().toString()
        ),
        XhtmlMatchers.hasXPaths(
            "/skeleton/app/package[count(class)=2]",
            "//class[@id='Bar']/methods[count(method)=5]",
            "//class[@id='OverloadMethods']/methods[count(method)=5]",
            "//method[@name='<init>' and @ctor='true']",
            "//class[@id='Bar']//method[@name='<init>']/ops[count(op)=3]"
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:18,代码来源:SkeletonTest.java

示例4: acceptsAndRenders

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void acceptsAndRenders() throws Exception {
    final Path output = Files.createTempDirectory("").resolve("x2");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    final Mistakes mistakes = new Mistakes();
    mistakes.add(output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new Xembler(
                new Directives().add("metrics").append(
                    new Joined<Directive>(mistakes.worst())
                )
            ).xmlQuietly()
        ),
        XhtmlMatchers.hasXPath("/metrics/metric[@id='LCOM']/avg")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:19,代码来源:MistakesTest.java

示例5: acceptsAndRenders

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void acceptsAndRenders() throws Exception {
    final Path output = Files.createTempDirectory("").resolve("x2");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    final Results results = new Results();
    results.add("org.takes:takes", output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new Xembler(
                new Directives().add("repos").append(
                    new Joined<Directive>(results.recent())
                )
            ).xmlQuietly()
        ),
        XhtmlMatchers.hasXPath("/repos")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:19,代码来源:ResultsTest.java

示例6: rendersMistakesPageInXml

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void rendersMistakesPageInXml() throws IOException {
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                new TkMistakes().act(
                    new RqWithHeaders(
                        new RqFake(),
                        "Accept: application/vnd.jpeek+xml"
                    )
                )
            ).printBody()
        ),
        XhtmlMatchers.hasXPath("/page/worst")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:17,代码来源:TkMistakesTest.java

示例7: rendersOneReport

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void rendersOneReport() throws Exception {
    final ExecutorService service = Executors.newSingleThreadExecutor();
    final BiFunc<String, String, Func<String, Response>> bifunc =
        new AsyncReports(
            new SolidBiFunc<>(
                (first, second) -> service.submit(
                    () -> input -> {
                        TimeUnit.DAYS.sleep(1L);
                        return new RsText("done!");
                    }
                )
            )
        );
    final Response response =
        bifunc.apply("org.jpeek", "jpeek").apply("index.html");
    MatcherAssert.assertThat(
        response,
        new HmRsStatus(HttpURLConnection.HTTP_OK)
    );
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(new RsPrint(response).printBody()),
        XhtmlMatchers.hasXPath("//xhtml:body")
    );
    service.shutdownNow();
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:27,代码来源:AsyncReportsTest.java

示例8: createsXmlReportWithXpaths

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void createsXmlReportWithXpaths() throws IOException {
    final Path output = Files.createTempDirectory("");
    new Report(
        new Skeleton(
            new FakeBase(
                "NoMethods", "Bar", "OverloadMethods",
                "OnlyOneMethodWithParams", "WithoutAttributes"
            )
        ).xml(),
        "LCOM"
    ).save(output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new TextOf(output.resolve("LCOM.xml")).asString()
        ),
        XhtmlMatchers.hasXPaths(
            "/metric/app/package/class/vars",
            "/metric/statistics/mean",
            "/metric/bars/bar[@x='0' and .='0' and @color='yellow']"
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:24,代码来源:ReportTest.java

示例9: testsTarget

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void testsTarget() throws IOException {
    final Path output = Files.createTempDirectory("");
    new Report(
        new Skeleton(new FakeBase(this.target)).xml(),
        this.metric
    ).save(output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new TextOf(
                output.resolve(String.format("%s.xml", this.metric))
            ).asString()
        ),
        XhtmlMatchers.hasXPaths(
            String.format(
                "//class[@id='%s' and number(@value)=%.4f]",
                this.target, this.value
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:22,代码来源:MetricsTest.java

示例10: createsXmlReports

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void createsXmlReports() throws IOException {
    final Path output = Files.createTempDirectory("").resolve("x1");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    MatcherAssert.assertThat(
        Files.exists(output.resolve("LCOM.xml")),
        Matchers.equalTo(true)
    );
    MatcherAssert.assertThat(
        XSLDocument
            .make(this.getClass().getResourceAsStream("xsl/metric.xsl"))
            .with(new ClasspathSources())
            .applyTo(new XMLDocument(output.resolve("LCOM.xml").toFile())),
        XhtmlMatchers.hasXPath("//xhtml:body")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:18,代码来源:AppTest.java

示例11: createsIndexXml

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void createsIndexXml() throws IOException {
    final Path output = Files.createTempDirectory("").resolve("x7");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new TextOf(output.resolve("index.xml")).asString()
        ),
        XhtmlMatchers.hasXPaths(
            "/index[@score!='0.0000']",
            "/index[@score!='NaN']",
            "/index[@diff!='NaN']",
            "/index[count(metric)>0]"
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:18,代码来源:AppTest.java

示例12: createsXml

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
@Test
public void createsXml() {
    final XML xml = new ReportWithStatistics(
        new XMLDocument("<metric/>")
    );
    final int threads = 10;
    final ExecutorService service = Executors.newFixedThreadPool(threads);
    final CountDownLatch latch = new CountDownLatch(1);
    for (int thread = 0; thread < threads; ++thread) {
        service.submit(
            () -> {
                latch.await();
                xml.toString();
                return null;
            }
        );
    }
    latch.countDown();
    service.shutdown();
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            xml.toString()
        ),
        XhtmlMatchers.hasXPaths("/metric/statistics[total='0']")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:27,代码来源:ReportWithStatisticsTest.java

示例13: rendersHomePageInHtml

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
/**
 * TkIndex can render home page in HTML.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePageInHtml() throws Exception {
    final Take take = new TkAppAuth(new TkIndex(new FkBase()));
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                take.act(new RqFake("GET", "/"))
            ).printBody()
        ),
        XhtmlMatchers.hasXPaths(
            "/xhtml:html",
            "/xhtml:html/xhtml:body"
        )
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:20,代码来源:TkIndexTest.java

示例14: rendersHomePage

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
/**
 * App can render front page.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePage() throws Exception {
    final Take take = new TkApp(new FkBase());
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                take.act(
                    new RqWithHeader(
                        new RqFake("GET", "/"),
                        // @checkstyle MultipleStringLiteralsCheck (1 line)
                        "Accept",
                        "text/xml"
                    )
                )
            ).printBody()
        ),
        XhtmlMatchers.hasXPaths(
            "/page/@date",
            "/page/@sla",
            "/page/millis",
            "/page/links/link[@rel='takes:logout']"
        )
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:29,代码来源:TkAppTest.java

示例15: rendersHomePage

import com.jcabi.matchers.XhtmlMatchers; //导入依赖的package包/类
/**
 * TkHome can render home page.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePage() throws Exception {
    final Take take = new TkIndex(new FkBase());
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new RsPrint(
                take.act(
                    new RqWithHeader(
                        new RqFake("GET", "/"),
                        "Accept",
                        "text/xml"
                    )
                )
            ).printBody()
        ),
        XhtmlMatchers.hasXPaths(
            "/page/millis",
            "/page/links/link[@rel='takes:github']",
            "/page/total"
        )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:27,代码来源:TkIndexTest.java


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