use of org.cactoos.io.InputStreamOf 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 org.cactoos.io.InputStreamOf 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());
}
use of org.cactoos.io.InputStreamOf in project wring by yegor256.
the class BoostEventsTest 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);
final Event event = Mockito.mock(Event.class);
Mockito.doReturn(event).when(events).event(Mockito.anyString());
new BoostEvents(events, Json.createReader(new InputStreamOf("{}")).readObject()).post("the title", "the body");
Mockito.verify(event, Mockito.never()).vote(Mockito.anyInt());
}
Aggregations