コード例 #1
0
 @Test
 public void canWriteAttributeByNamespaceAndNonExistingName() {
   String newValue =
       element
           .attrNs(EXAMPLE_NAMESPACE, NON_EXISTING, "newValue")
           .attrNs(EXAMPLE_NAMESPACE, NON_EXISTING)
           .value();
   assertThat(newValue).isEqualTo("newValue");
 }
コード例 #2
0
 @Test
 public void canWriteAttributeByNamespaceAndName() {
   String newValue =
       element
           .attrNs(EXAMPLE_NAMESPACE, "order", "order2")
           .attrNs(EXAMPLE_NAMESPACE, "order")
           .value();
   assertThat(newValue).isEqualTo("order2");
 }
コード例 #3
0
 @Test
 public void canWriteAttributeByNonExistingNamespaceAndName() {
   String newValue =
       element.attrNs(NON_EXISTING, "order", "newValue").attrNs(NON_EXISTING, "order").value();
   assertThat(newValue).isEqualTo("newValue");
 }
コード例 #4
0
 @Test(expected = IllegalArgumentException.class)
 public void cannotWriteAttributeByNamespaceAndNameWithNullValue() {
   element.attrNs(EXAMPLE_NAMESPACE, "order", null);
 }
コード例 #5
0
 @Test(expected = IllegalArgumentException.class)
 public void cannotWriteAttributeByNamespaceAndNullName() {
   element.attrNs(EXAMPLE_NAMESPACE, null, "newValue");
 }
コード例 #6
0
 @Test(expected = IllegalArgumentException.class)
 public void cannotReadAttributeByNullNamespaceAndNullName() {
   element.attrNs(null, null);
 }
コード例 #7
0
 @Test(expected = SpinXmlAttributeException.class)
 public void cannotReadAttributeByNonExistingNamespaceAndNonExistingName() {
   element.attrNs(NON_EXISTING, NON_EXISTING);
 }
コード例 #8
0
 @Test
 public void canReadAttributeByNullNamespaceAndName() {
   SpinXmlAttribute attribute = element.attrNs(null, "order");
   String value = attribute.value();
   assertThat(value).isEqualTo("order1");
 }
コード例 #9
0
 @Test
 public void canReadAttributeByNamespaceAndName() {
   SpinXmlAttribute attribute = element.attrNs(EXAMPLE_NAMESPACE, "dueUntil");
   String value = attribute.value();
   assertThat(value).isEqualTo("20150112");
 }