/** * Sends a message with the specified attachment, waits for the message to arrives, and runs a * query. * * @param subject the subject of the message * @param attData attachment data * @param attName attachment name * @param attContentType attachment content type * @param query query to run after message arrives * @return <tt>true</tt> if the query returns the message */ private ZMessage sendMessage( String subject, byte[] attData, String attName, String attContentType) throws Exception { // Send message ZMailbox mbox = TestUtil.getZMailbox(USER_NAME); String attachmentId = mbox.uploadAttachment(attName, attData, attContentType, 5000); TestUtil.sendMessage(mbox, USER_NAME, subject, "Cranberry sauce", attachmentId); String query = "in:inbox subject:\"" + subject + "\""; return TestUtil.waitForMessage(mbox, query); }