public void runTest() throws Throwable {
  Document doc;
  NodeList genderList;
  Node genderNode;
  CharacterData entText;
  EntityReference entReference;
  doc=(Document)load("staff",true);
  genderList=doc.getElementsByTagName("gender");
  genderNode=genderList.item(2);
  entReference=doc.createEntityReference("ent3");
  assertNotNull("createdEntRefNotNull",entReference);
  entText=(CharacterData)entReference.getFirstChild();
  assertNotNull("entTextNotNull",entText);
{
    boolean success=false;
    try {
      entText.insertData(1,"newArg");
    }
 catch (    DOMException ex) {
      success=(ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
    assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
  }
}

public void runTest ( ) throws Throwable { Document doc ; NodeList genderList ; Node genderNode ; CharacterData entText ; EntityReference entReference ; doc = ( Document ) load ( "staff" , true ) ; genderList = doc . getElementsByTagName ( "gender" ) ; genderNode = genderList . item ( 2 ) ; entReference = doc . createEntityReference ( "ent3" ) ; assertNotNull ( "createdEntRefNotNull" , entReference ) ; entText = ( CharacterData ) entReference . getFirstChild ( ) ; assertNotNull ( "entTextNotNull" , entText ) ; { boolean success = false ; try { entText . insertData ( 1 , "newArg" ) ; } catch ( DOMException ex ) { success = ( ex . code == DOMException . NO_MODIFICATION_ALLOWED_ERR ) ; } assertTrue ( "throw_NO_MODIFICATION_ALLOWED_ERR" , success ) ; } }
runs the test case .
