@Test public void canGetAllAttributesByNamespace() { SpinList<SpinXmlAttribute> attributes = element.attrs(EXAMPLE_NAMESPACE); for (SpinXmlAttribute attribute : attributes) { assertThat(attribute.name()).isIn("order", "dueUntil"); assertThat(attribute.value()).isIn("order1", "20150112"); assertThat(attribute.namespace()).isEqualTo(EXAMPLE_NAMESPACE); } }
@Test public void canGetAllAttributesByNullNamespace() { SpinList<SpinXmlAttribute> attributes = element.attrs(null); for (SpinXmlAttribute attribute : attributes) { assertThat(attribute.name()).isIn("order", "dueUntil"); assertThat(attribute.value()).isIn("order1", "20150112"); assertThat(attribute.namespace()).isNull(); } }
@Test public void canReadAttributeByName() { SpinXmlAttribute attribute = element.attr("order"); String value = attribute.value(); assertThat(value).isEqualTo("order1"); }
@Test public void canReadAttributeByNamespaceAndName() { SpinXmlAttribute attribute = element.attrNs(EXAMPLE_NAMESPACE, "dueUntil"); String value = attribute.value(); assertThat(value).isEqualTo("20150112"); }