use of io.wring.model.User in project wring by yegor256.
the class DyEventsITCase method addsManyEvents.
/**
* DyEvents can add many events.
* @throws Exception If some problem inside
*/
@Test
public void addsManyEvents() throws Exception {
final User user = new DyUser(new Dynamo(), "william");
final Events events = user.events();
for (int idx = 0; idx < Tv.FIVE; ++idx) {
events.post(String.format("event #%d", idx), "some text");
}
MatcherAssert.assertThat(Iterables.size(events.iterate()), Matchers.equalTo(Tv.FIVE));
}
use of io.wring.model.User in project wring by yegor256.
the class DyEventsITCase method postsAndVotes.
/**
* DyEvents can post and vote.
* @throws Exception If some problem inside
*/
@Test
public void postsAndVotes() throws Exception {
final User user = new DyUser(new Dynamo(), "erikk");
final Events events = user.events();
final String title = "the title of the Event --+";
events.post(title, "some body text of the event");
events.event(title).vote(1);
MatcherAssert.assertThat(new Xembler(events.event(title).asXembly()).xml(), XhtmlMatchers.hasXPaths("/event[rank=2]"));
}
use of io.wring.model.User in project wring by yegor256.
the class DyEventsITCase method appendsToExistingEvents.
/**
* DyEvents can append text to.
* @throws Exception If some problem inside
*/
@Test
public void appendsToExistingEvents() throws Exception {
final User user = new DyUser(new Dynamo(), "peter");
final Events events = user.events();
final String title = "a simple title";
events.post(title, "\n\tfirst body");
events.post(title, "\n\u0000\u00fdin between");
events.post(title, "second body\n\n");
MatcherAssert.assertThat(new Xembler(events.iterate().iterator().next().asXembly()).xml(), XhtmlMatchers.hasXPaths("/event/text[contains(.,'first')]", "/event/text[contains(.,'second body')]", "/event/text[not(contains(.,'first body\n'))]"));
}
use of io.wring.model.User in project wring by yegor256.
the class DyPipesITCase method addsAndRemovePipes.
/**
* DyPipes can add and remove pipes.
* @throws Exception If some problem inside
*/
@Test
public void addsAndRemovePipes() throws Exception {
final User user = new DyUser(new Dynamo(), "jeffrey");
final Pipes pipes = user.pipes();
pipes.add("{\"name\": \"hello\"}");
final Pipe pipe = pipes.iterate().iterator().next();
MatcherAssert.assertThat(new Xembler(pipe.asXembly()).xml(), XhtmlMatchers.hasXPaths("/pipe/json", "/pipe/id"));
pipe.delete();
}
use of io.wring.model.User in project wring by yegor256.
the class DyUserITCase method rendersPipes.
/**
* DyUser can render pipes.
* @throws Exception If some problem inside
*/
@Test
public void rendersPipes() throws Exception {
final User user = new DyUser(new Dynamo(), "jeff");
MatcherAssert.assertThat(user.pipes(), Matchers.notNullValue());
}
Aggregations