Github user rafaelweingartner commented on the pull request: https://github.com/apache/cloudstack/pull/1331#issuecomment-211485538 I agree with you @syed, it is always good to discuss the patterns we use. That example you brought up also works; it would do the same tricky to test, but using an appender stead of mocking. I am good with that too; I just coded differently, because I do not like much the idea of getting log entries by hand. But, I am willing to go either way. If you go the other way, please revert my commit, so the history does not get messed up. For the new tests you have to write, you could mock the creation of the Object buffered writer, to one that you can control and check if the âwriteâ method is been used as expected. In other words, writing the strings you expect to write. Here there is an example of that for the File class (it is not the same, but it will give you an idea): http://stackoverflow.com/questions/11849728/simulate-file-in-java
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---