GetEmitOutput And Testfiles

1. no 'this;
2. you already returned without setting it when you checked the error part. so either set it there, or write a small helper withWriter(newWriter, action), that will set the writer, do the action, then reset it again.