context.checking(new Expectations() {{
one(details).open();
will(returnValue(new ByteArrayInputStream("content".getBytes())));
}});
mappedDetails.filter(HelperUtil.toClosure("{ 'PREFIX: ' + it } "));
ByteArrayOutputStream outstr = new ByteArrayOutputStream();
mappedDetails.copyTo(outstr);
assertThat(new String(outstr.toByteArray()), equalTo("PREFIX: content"));
}