@Test public void testOtherMessageTypes() { setEventMessage("m.image", "'body': 'Bob.jpeg'"); Assert.assertTrue(condition.isSatisfied(event, displayName)); setEventMessage("m.image", "'url': 'Bob'"); Assert.assertFalse(condition.isSatisfied(event, displayName)); setEventMessage("m.notice", "'body': 'Bob did something or other'"); Assert.assertTrue(condition.isSatisfied(event, displayName)); setEventMessage("m.emote", "'body': 'is angry with Bob'"); Assert.assertTrue(condition.isSatisfied(event, displayName)); }
public boolean isSatisfied(Event event, String myDisplayName) { if (Event.EVENT_TYPE_MESSAGE.equals(event.getType())) { Message msg = JsonUtils.toMessage(event.getContent()); if (null != msg) { return EventUtils.caseInsensitiveFind(myDisplayName, msg.body); } } return false; }
ContainsDisplayNameCondition extends Condition { public boolean isSatisfied(Event event, String myDisplayName) { if (Event.EVENT_TYPE_MESSAGE.equals(event.getType())) { Message msg = JsonUtils.toMessage(event.getContent()); if (null != msg) { return EventUtils.caseInsensitiveFind(myDisplayName, msg.body); } } return false; } }
ContainsDisplayNameCondition extends Condition { public boolean isSatisfied(Event event, String myDisplayName) { if (Event.EVENT_TYPE_MESSAGE.equals(event.getType())) { Message msg = JsonUtils.toMessage(event.getContent()); if (null != msg) { return EventUtils.caseInsensitiveFind(myDisplayName, msg.body); } } return false; } ContainsDisplayNameCondition(); }
ContainsDisplayNameCondition extends Condition { public boolean isSatisfied(Event event, String myDisplayName) { if (Event.EVENT_TYPE_MESSAGE.equals(event.getType())) { Message msg = JsonUtils.toMessage(event.getContent()); if (null != msg) { return EventUtils.caseInsensitiveFind(myDisplayName, msg.body); } } return false; } ContainsDisplayNameCondition(); boolean isSatisfied(Event event, String myDisplayName); }
ContainsDisplayNameCondition extends Condition { public boolean isSatisfied(Event event, String myDisplayName) { if (Event.EVENT_TYPE_MESSAGE.equals(event.getType())) { Message msg = JsonUtils.toMessage(event.getContent()); if (null != msg) { return EventUtils.caseInsensitiveFind(myDisplayName, msg.body); } } return false; } ContainsDisplayNameCondition(); boolean isSatisfied(Event event, String myDisplayName);  }