| 1 33 34 package edu.rice.cs.drjava.model.definitions.indent; 35 36 import edu.rice.cs.drjava.DrJavaTestCase; 37 import edu.rice.cs.drjava.model.AbstractDJDocument; 38 39 import javax.swing.text.AbstractDocument ; 40 import javax.swing.text.BadLocationException ; 41 43 47 public abstract class IndentRulesTestCase extends DrJavaTestCase { 48 49 protected volatile AbstractDJDocument _doc; 50 53 54 public void setUp() throws Exception { 55 super.setUp(); 56 _doc = new AbstractDJDocument() { 59 protected int startCompoundEdit() { 60 return 0; 62 } 63 protected void endCompoundEdit(int key) { } 64 protected void endLastCompoundEdit() { } 65 protected void addUndoRedo(AbstractDocument.DefaultDocumentEvent chng, Runnable undoCommand, Runnable doCommand) { 66 67 } 68 protected void _styleChanged() { } 69 protected Indenter makeNewIndenter(int indentLevel) { return new Indenter(indentLevel); } 70 }; 71 } 72 73 public void tearDown() throws Exception { 74 _doc = null; 75 System.gc(); 77 super.tearDown(); 78 } 79 80 82 protected final void _setDocText(String text) 83 throws BadLocationException { 84 _doc.clear(); 85 _doc.insertString(0, text, null); 86 } 87 88 97 98 105 106 117 118 131 132 136 protected void _assertContents(String expected) throws BadLocationException { 137 assertEquals("document contents", 138 expected, 139 _doc.getText()); 140 } 141 142 } 143 | Popular Tags |