/** * InstantRs can process a Requs spec. * * @throws Exception If some problem inside */ @Test public void processesRequsSpec() throws Exception { final InstantRs res = new InstantRs(); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); final SecurityContext sec = Mockito.mock(SecurityContext.class); res.setSecurityContext(sec); final String xml = res.post("User is a \"type\"."); MatcherAssert.assertThat(xml, XhtmlMatchers.hasXPath("/spec/types/type[name='User']")); }
/** * XSLT can transform a snapshot. * * @throws Exception If some problem inside */ @Test public void transformsSnapshot() throws Exception { MatcherAssert.assertThat( XhtmlMatchers.xhtml( new XSLT( new Snapshot( new Directives() // @checkstyle MultipleStringLiteralsCheck (1 lines) .xpath("/snapshot") .add("start") .set("2012-08-23T13:00:00Z")), // @checkstyle StringLiteralsConcatenation (5 lines) "<xsl:stylesheet" + " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" + " version='2.0'>" + "<xsl:template match='snapshot'><test/>" + "</xsl:template></xsl:stylesheet>") .dom()), XhtmlMatchers.hasXPath("/test")); }