public void testValue() throws Exception {
    ICompilationUnit cu = createTestXmlPathWithValue();
    JavaResourceType resourceType = buildJavaResourceType(cu);
    JavaResourceField resourceAttribute = getField(resourceType, 0);
    XmlPathAnnotation annotation = getXmlPathAnnotation(resourceAttribute);

    assertEquals("foo", annotation.getValue());
    assertSourceContains("@XmlPath(\"foo\")", cu);

    annotation.setValue("bar");

    assertEquals("bar", annotation.getValue());
    assertSourceContains("@XmlPath(\"bar\")", cu);

    annotation.setValue("");

    assertEquals("", annotation.getValue());
    assertSourceContains("@XmlPath(\"\")", cu);

    annotation.setValue(null);

    assertNull(annotation.getValue());
    assertSourceContains("@XmlPath", cu);
    assertSourceDoesNotContain("@XmlPath(", cu);
  }
  public void testContainedValue() throws Exception {
    // test contained annotation value setting/updating

    ICompilationUnit cu = createTestXmlPaths();
    JavaResourceType resourceType = buildJavaResourceType(cu);
    JavaResourceField resourceAttribute = getField(resourceType, 0);
    XmlPathAnnotation annotation = getXmlPathAnnotation(resourceAttribute);

    assertNull(annotation.getValue());
    assertSourceContains("@XmlPaths({@XmlPath,@XmlPath})", cu);

    annotation.setValue("foo");
    assertEquals("foo", annotation.getValue());
    assertSourceContains("@XmlPaths({@XmlPath(\"foo\"),@XmlPath})", cu);

    annotation.setValue(null);
    assertNull(annotation.getValue());
    assertSourceContains("@XmlPaths({@XmlPath,@XmlPath})", cu);
  }