CssMediaRule extends CssNestedAtRule { public boolean matchMediaDevice(MediaDeviceDescription deviceDescription) { for (MediaQuery mediaQuery : mediaQueries) { if (mediaQuery.matches(deviceDescription)) { return true; } } return false; } CssMediaRule(String ruleParameters); @Override List<CssRuleSet> getCssRuleSets(INode element, MediaDeviceDescription deviceDescription); boolean matchMediaDevice(MediaDeviceDescription deviceDescription);  }
@Test public void matchMediaDeviceTest() { MediaDeviceDescription deviceDescription = new MediaDeviceDescription("all"); deviceDescription.setHeight(450); deviceDescription.setWidth(600); CssMediaRule rule = new CssMediaRule("@media all and (min-width: 600px) and (min-height: 600px)"); Assert.assertTrue(rule.matchMediaDevice(deviceDescription)); }