HtmlMicrodata { public String getFirstType() { return types != null && !types.isEmpty() ? types.iterator().next() : null; } HtmlMicrodata();  HtmlMicrodata(URL url, Element item); Set<String> getTypes(); void setTypes(Set<String> types); String getId(); void setId(String id); Map<String, List<Object>> getProperties(); void setProperties(Map<String, List<Object>> properties); String getFirstType(); Object getFirstProperty(String name); @Override String toString();  }
@Test public void Static_getFirstType_invalid() { List<HtmlMicrodata> microdatas = HtmlMicrodata.Static.parseDocument(testUrl, getDocument("simple-content.html")); HtmlMicrodata microdata = HtmlMicrodata.Static.getFirstType(microdatas, Arrays.asList(new String[] { "http: })); assertEquals(null, microdata); }
@Test public void Static_getFirstType_valid() { List<HtmlMicrodata> microdatas = HtmlMicrodata.Static.parseDocument(testUrl, getDocument("simple-content.html")); HtmlMicrodata microdata = HtmlMicrodata.Static.getFirstType(microdatas, Arrays.asList(new String[] { "http: })); assertEquals("http: }
@Test public void Static_getFirstType_notFirst() { List<HtmlMicrodata> microdatas = HtmlMicrodata.Static.parseDocument(testUrl, getDocument("simple-content.html")); HtmlMicrodata microdata = HtmlMicrodata.Static.getFirstType(microdatas, Arrays.asList(new String[] { "http: "http: })); assertEquals("http: }