CombinedMessageSelector implements MessageSelector { @Override public boolean matches(final OSCMessageEvent messageEvent) { return logicOperator.matches(selector1.matches(messageEvent), selector2.matches(messageEvent)); } @SuppressWarnings("WeakerAccess")  CombinedMessageSelector(
			final MessageSelector selector1,
			final MessageSelector selector2,
			final LogicOperator logicOperator); @SuppressWarnings("WeakerAccess")  CombinedMessageSelector(
			final MessageSelector selector1,
			final MessageSelector selector2); @Override boolean isInfoRequired(); @Override boolean matches(final OSCMessageEvent messageEvent);  }
@Test public void testNoAddressNorArgs() { final MessageSelector matcher = new CombinedMessageSelector( new OSCPatternAddressMessageSelector("/"), new OSCPatternTypeTagsMessageSelector(""), CombinedMessageSelector.LogicOperator.AND); Assert.assertTrue( matches(matcher, "/", "")); Assert.assertFalse(matches(matcher, "/hello", "")); Assert.assertFalse(matches(matcher, "/", "i")); Assert.assertFalse(matches(matcher, "/hello", "i")); }
@Test public void testNoArgs() { final MessageSelector matcher = new CombinedMessageSelector( new OSCPatternAddressMessageSelector("/hello"), new OSCPatternTypeTagsMessageSelector(""), CombinedMessageSelector.LogicOperator.AND); Assert.assertFalse( matches(matcher, "/", "")); Assert.assertTrue(matches(matcher, "/hello", "")); Assert.assertFalse(matches(matcher, "/", "i")); Assert.assertFalse(matches(matcher, "/hello", "i")); }
@Test public void testAddressAndArgs() { final MessageSelector matcher = new CombinedMessageSelector( new OSCPatternAddressMessageSelector("/hello"), new OSCPatternTypeTagsMessageSelector("i"), CombinedMessageSelector.LogicOperator.AND); Assert.assertFalse(matches(matcher, "/", "")); Assert.assertFalse(matches(matcher, "/hello", "")); Assert.assertFalse(matches(matcher, "/", "i")); Assert.assertTrue( matches(matcher, "/hello", "i")); }
@Test public void testPartPostfix() { final MessageSelector matcher = new CombinedMessageSelector( new OSCPatternAddressMessageSelector("/hello"), new OSCPatternTypeTagsMessageSelector("i"), CombinedMessageSelector.LogicOperator.OR); Assert.assertFalse(matches(matcher, "/", "")); Assert.assertTrue( matches(matcher, "/hello", "")); Assert.assertTrue( matches(matcher, "/", "i")); Assert.assertTrue( matches(matcher, "/hello", "i")); }