@Test public void canWriteAttributeByNamespaceAndNonExistingName() { String newValue = element .attrNs(EXAMPLE_NAMESPACE, NON_EXISTING, "newValue") .attrNs(EXAMPLE_NAMESPACE, NON_EXISTING) .value(); assertThat(newValue).isEqualTo("newValue"); }
@Test public void canWriteAttributeByNamespaceAndName() { String newValue = element .attrNs(EXAMPLE_NAMESPACE, "order", "order2") .attrNs(EXAMPLE_NAMESPACE, "order") .value(); assertThat(newValue).isEqualTo("order2"); }
@Test public void canWriteAttributeByNonExistingNamespaceAndName() { String newValue = element.attrNs(NON_EXISTING, "order", "newValue").attrNs(NON_EXISTING, "order").value(); assertThat(newValue).isEqualTo("newValue"); }
@Test(expected = IllegalArgumentException.class) public void cannotWriteAttributeByNamespaceAndNameWithNullValue() { element.attrNs(EXAMPLE_NAMESPACE, "order", null); }
@Test(expected = IllegalArgumentException.class) public void cannotWriteAttributeByNamespaceAndNullName() { element.attrNs(EXAMPLE_NAMESPACE, null, "newValue"); }
@Test(expected = IllegalArgumentException.class) public void cannotReadAttributeByNullNamespaceAndNullName() { element.attrNs(null, null); }
@Test(expected = SpinXmlAttributeException.class) public void cannotReadAttributeByNonExistingNamespaceAndNonExistingName() { element.attrNs(NON_EXISTING, NON_EXISTING); }
@Test public void canReadAttributeByNullNamespaceAndName() { SpinXmlAttribute attribute = element.attrNs(null, "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"); }