use of io.wring.fake.FkPipe in project wring by yegor256.
the class CycleTest method processesSinglePipe.
/**
* Cycle can process a single pipe.
* @throws Exception If some problem inside
*/
@Test
public void processesSinglePipe() throws Exception {
final Base base = new FkBase();
final Pipe pipe = new FkPipe();
new Cycle(base).exec(pipe);
}
use of io.wring.fake.FkPipe in project wring by yegor256.
the class CycleTest method processesSinglePipeWithBrokenJson.
/**
* Cycle can process a single pipe with broken JSOn.
* @throws Exception If some problem inside
*/
@Test
public void processesSinglePipeWithBrokenJson() throws Exception {
final Base base = new FkBase();
final Pipe pipe = new FkPipe(new Directives().add("pipe").add("urn").set("urn:test:1").up().add("json").set("{\"a\":\"/@[a-z0-9\\\\-]\\\\s+\"}").up().up());
new Cycle(base).exec(pipe);
}
use of io.wring.fake.FkPipe in project wring by yegor256.
the class ExecTest method catchesExceptions.
/**
* Exec can catch in case of an error.
* @throws Exception If some problem inside
*/
@Test
public void catchesExceptions() throws Exception {
final Agent agent = Mockito.mock(Agent.class);
final Events events = Mockito.mock(Events.class);
Mockito.doThrow(new IOException("<bug>")).when(agent).push(events);
new Exec(agent, events, new FkPipe()).run();
Mockito.verify(events).post(MockitoHamcrest.argThat(Matchers.startsWith("Internal error (java.io.IOException): \"<bug>\"")), MockitoHamcrest.argThat(Matchers.containsString("java.io.IOException: <bug>\n")));
}
Aggregations