Java 类org.jsoup.nodes.BooleanAttribute 实例源码

项目:common    文件:AttributeParseTest.java   
@Test public void parsesBooleanAttributes() {
      String html = "<a normal=\"123\" boolean empty=\"\"></a>";
      Element el = Jsoup.parse(html).select("a").first();

      assertEquals("123", el.attr("normal"));
      assertEquals("", el.attr("boolean"));
      assertEquals("", el.attr("empty"));

      List<Attribute> attributes = el.attributes().asList();
      assertEquals("There should be 3 attribute present", 3, attributes.size());

      // Assuming the list order always follows the parsed html
assertFalse("'normal' attribute should not be boolean", attributes.get(0) instanceof BooleanAttribute);        
assertTrue("'boolean' attribute should be boolean", attributes.get(1) instanceof BooleanAttribute);        
assertFalse("'empty' attribute should not be boolean", attributes.get(2) instanceof BooleanAttribute);        

      assertEquals(html, el.outerHtml());
  }
项目:astor    文件:AttributeParseTest.java   
@Test public void parsesBooleanAttributes() {
      String html = "<a normal=\"123\" boolean empty=\"\"></a>";
      Element el = Jsoup.parse(html).select("a").first();

      assertEquals("123", el.attr("normal"));
      assertEquals("", el.attr("boolean"));
      assertEquals("", el.attr("empty"));

      List<Attribute> attributes = el.attributes().asList();
      assertEquals("There should be 3 attribute present", 3, attributes.size());

      // Assuming the list order always follows the parsed html
assertFalse("'normal' attribute should not be boolean", attributes.get(0) instanceof BooleanAttribute);        
assertTrue("'boolean' attribute should be boolean", attributes.get(1) instanceof BooleanAttribute);        
assertFalse("'empty' attribute should not be boolean", attributes.get(2) instanceof BooleanAttribute);        

      assertEquals(html, el.outerHtml());
  }
项目:astor    文件:AttributeParseTest.java   
@Test public void parsesBooleanAttributes() {
      String html = "<a normal=\"123\" boolean empty=\"\"></a>";
      Element el = Jsoup.parse(html).select("a").first();

      assertEquals("123", el.attr("normal"));
      assertEquals("", el.attr("boolean"));
      assertEquals("", el.attr("empty"));

      List<Attribute> attributes = el.attributes().asList();
      assertEquals("There should be 3 attribute present", 3, attributes.size());

      // Assuming the list order always follows the parsed html
assertFalse("'normal' attribute should not be boolean", attributes.get(0) instanceof BooleanAttribute);        
assertTrue("'boolean' attribute should be boolean", attributes.get(1) instanceof BooleanAttribute);        
assertFalse("'empty' attribute should not be boolean", attributes.get(2) instanceof BooleanAttribute);        

      assertEquals(html, el.outerHtml());
  }
项目:astor    文件:AttributeParseTest.java   
@Test public void parsesBooleanAttributes() {
      String html = "<a normal=\"123\" boolean empty=\"\"></a>";
      Element el = Jsoup.parse(html).select("a").first();

      assertEquals("123", el.attr("normal"));
      assertEquals("", el.attr("boolean"));
      assertEquals("", el.attr("empty"));

      List<Attribute> attributes = el.attributes().asList();
      assertEquals("There should be 3 attribute present", 3, attributes.size());

      // Assuming the list order always follows the parsed html
assertFalse("'normal' attribute should not be boolean", attributes.get(0) instanceof BooleanAttribute);        
assertTrue("'boolean' attribute should be boolean", attributes.get(1) instanceof BooleanAttribute);        
assertFalse("'empty' attribute should not be boolean", attributes.get(2) instanceof BooleanAttribute);        

      assertEquals(html, el.outerHtml());
  }