@Test(expected = FormatException.class) public void testRejectsTooLongContent() throws Exception { PrivateMessageValidator v = new PrivateMessageValidator(clientHelper, metadataEncoder, clock); String invalidContent = StringUtils.getRandomString(MAX_PRIVATE_MESSAGE_BODY_LENGTH + 1); v.validateMessage(message, group, BdfList.of(invalidContent)); }
@Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 1); String privateMessageBody = body.getString(0); checkLength(privateMessageBody, 0, MAX_PRIVATE_MESSAGE_BODY_LENGTH); BdfDictionary meta = new BdfDictionary(); meta.put("timestamp", m.getTimestamp()); meta.put("local", false); meta.put(MSG_KEY_READ, false); return new BdfMessageContext(meta); }
PrivateMessageValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 1); String privateMessageBody = body.getString(0); checkLength(privateMessageBody, 0, MAX_PRIVATE_MESSAGE_BODY_LENGTH); BdfDictionary meta = new BdfDictionary(); meta.put("timestamp", m.getTimestamp()); meta.put("local", false); meta.put(MSG_KEY_READ, false); return new BdfMessageContext(meta); } }
PrivateMessageValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 1); String privateMessageBody = body.getString(0); checkLength(privateMessageBody, 0, MAX_PRIVATE_MESSAGE_BODY_LENGTH); BdfDictionary meta = new BdfDictionary(); meta.put("timestamp", m.getTimestamp()); meta.put("local", false); meta.put(MSG_KEY_READ, false); return new BdfMessageContext(meta); } PrivateMessageValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock); }
PrivateMessageValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 1); String privateMessageBody = body.getString(0); checkLength(privateMessageBody, 0, MAX_PRIVATE_MESSAGE_BODY_LENGTH); BdfDictionary meta = new BdfDictionary(); meta.put("timestamp", m.getTimestamp()); meta.put("local", false); meta.put(MSG_KEY_READ, false); return new BdfMessageContext(meta); } PrivateMessageValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock);  }
PrivateMessageValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 1); String privateMessageBody = body.getString(0); checkLength(privateMessageBody, 0, MAX_PRIVATE_MESSAGE_BODY_LENGTH); BdfDictionary meta = new BdfDictionary(); meta.put("timestamp", m.getTimestamp()); meta.put("local", false); meta.put(MSG_KEY_READ, false); return new BdfMessageContext(meta); } PrivateMessageValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock);   }