use of io.wring.model.Events in project wring by yegor256.
the class DyEventsITCase method deletesEvent.
/**
* DyEvents can delete events.
* @throws Exception If some problem inside
*/
@Test
public void deletesEvent() throws Exception {
final User user = new DyUser(new Dynamo(), "boris");
final Events events = user.events();
events.post("subj", "body");
final Event event = events.iterate().iterator().next();
event.delete();
MatcherAssert.assertThat(Iterables.size(events.iterate()), Matchers.equalTo(0));
}
use of io.wring.model.Events in project wring by yegor256.
the class BoostEventsTest method boostsEvents.
/**
* BoostEvents can boost events.
* @throws Exception If some problem inside
*/
@Test
public void boostsEvents() throws Exception {
final Events events = Mockito.mock(Events.class);
final Event event = Mockito.mock(Event.class);
Mockito.doReturn(event).when(events).event(Mockito.anyString());
new BoostEvents(events, "alpha.*").post("x", "an\nalpha one\nhere");
Mockito.verify(event).vote(Tv.FIVE);
}
use of io.wring.model.Events in project wring by yegor256.
the class BoostEventsTest method ignoresEventsThrough.
/**
* BoostEvents can ignore events.
* @throws Exception If some problem inside
*/
@Test
public void ignoresEventsThrough() throws Exception {
final Events events = Mockito.mock(Events.class);
new BoostEvents(events, "/beta.*/").post("y", "there is no text here");
}
use of io.wring.model.Events in project wring by yegor256.
the class IgnoreEventsTest method filtersEventsOutByJsonConfig.
/**
* IgnoreEvents can filter out events.
* @throws Exception If some problem inside
*/
@Test
public void filtersEventsOutByJsonConfig() throws Exception {
final Events events = Mockito.mock(Events.class);
new IgnoreEvents(events, Json.createReader(new InputStreamOf("{\"ignore\":[\"/gamma.*/\"]}")).readObject()).post("xx", "an\ngamma\nhere");
Mockito.verify(events, Mockito.never()).post(Mockito.anyString(), Mockito.anyString());
}
use of io.wring.model.Events in project wring by yegor256.
the class IgnoreEventsTest method passesEventsThroughByJsonConfig.
/**
* IgnoreEvents can filter out events.
* @throws Exception If some problem inside
*/
@Test
public void passesEventsThroughByJsonConfig() throws Exception {
final Events events = Mockito.mock(Events.class);
new IgnoreEvents(events, Json.createReader(new InputStreamOf("{}")).readObject()).post("xxy", "a\nbeta\nhere");
Mockito.verify(events).post(Mockito.anyString(), Mockito.anyString());
}
Aggregations