コード例 #1
0
  private static Style createStyle(String stylesheetText) {

    Stylesheet stylesheet = CSSParser.getInstance().parse(stylesheetText);
    Rule rule = stylesheet.getRules().get(0);
    Selector sel = rule.getUnobservedSelectorList().get(0);
    Declaration decl = rule.getUnobservedDeclarationList().get(0);
    return new Style(sel, decl);
  }
コード例 #2
0
 @Test
 public void testGetUnobservedDeclarationList() {
   List<Declaration> expResult = new ArrayList<Declaration>();
   expResult.add(new Declaration("one", new ParsedValueImpl<String, String>("one", null), false));
   expResult.add(new Declaration("two", new ParsedValueImpl<String, String>("two", null), false));
   expResult.add(
       new Declaration("three", new ParsedValueImpl<String, String>("three", null), false));
   Rule instance = new Rule(Collections.EMPTY_LIST, expResult);
   List result = instance.getUnobservedDeclarationList();
   assertEquals(expResult, result);
 }