@Test public void canGetAllAttributes() { SpinList<SpinXmlAttribute> attributes = element.attrs(); assertThat(attributes).hasSize(4); for (SpinXmlAttribute attribute : attributes) { assertThat(attribute.name()).isIn("order", "dueUntil", "xmlns", "ex"); } }
@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 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 canGetAllAttributesByNonExistingNamespace() { SpinList<SpinXmlAttribute> attributes = element.attrs(NON_EXISTING); assertThat(attributes).isEmpty(); }