### Question:
MessageStreamScriptService implements ScriptService { public boolean postPublicMessage(String message) { try { this.stream.postPublicMessage(message); return true; } catch (Exception e) { setError(e); return false; } }  boolean postPublicMessage(String message); boolean postPersonalMessage(String message); boolean postDirectMessageToUser(String message, DocumentReference user); boolean postMessageToGroup(String message, DocumentReference group); boolean deleteMessage(String id); boolean isActive(); Exception getLastError();  }### Answer:
@Test public void postPublicMessage() throws Exception { assertTrue(this.streamService.postPublicMessage("Hello World!")); MessageStream stream = this.mocker.getInstance(MessageStream.class); verify(stream).postPublicMessage("Hello World!"); }
@Test public void postPublicMessageWithFailure() throws Exception { MessageStream stream = this.mocker.getInstance(MessageStream.class); doThrow(new RuntimeException("error")).when(stream).postPublicMessage("Hello World!"); assertFalse(this.streamService.postPublicMessage("Hello World!")); }