edu.rice.cs.drjava.model.definitions
Class IndentHelperTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
                  extended by edu.rice.cs.drjava.model.definitions.IndentHelperTest
All Implemented Interfaces:
Test

public final class IndentHelperTest
extends IndentRulesTestCase

Tests for the helper methods in DefinitionsDocument

Version:
$Id: IndentHelperTest.java 5175 2010-01-20 08:46:32Z mgricken $

Nested Class Summary
 
Nested classes/interfaces inherited from class junit.framework.TestCase
TestCase.WrappedException
 
Field Summary
 
Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
_doc, TEST_INDENT_LEVEL
 
Constructor Summary
IndentHelperTest()
           
 
Method Summary
private  int _getIndentOfCurrStmt(int pos)
          Convenience method that wraps _doc.getIndentOfCurrStmt calls in a read lock.
private  int _getLineEndPos(int pos)
          Convenience method that wraps _doc.getLineEndPos calls in a read lock.
private  int _getLineFirstCharPos(int pos)
          Convenience method that wraps _doc.getLineFirstCharPos calls in a read lock.
private  int _getLineStartPos(int pos)
          Convenience method that wraps _doc.getLineStartPos calls in a read lock.
private  boolean _inParenPhrase(int pos)
          Convenience method that wraps _doc.inParenPhrase calls in a read lock.
private  int findPrevDelimiter(int pos, char[] delimiters)
          Convenience method that wraps _doc.findPrevDelimiter calls in a read lock.
private  int getFirstNonWSCharPos(int pos)
          Convenience method that wraps _doc.getFirstNonWSCharPos calls in a read lock.
 void testFindPrevDelimiter()
          Tests findPrevDelimiter()
 void testGetFirstNonWSCharPos()
           
 void testGetIndentOfCurrStmtDelimiters()
           
 void testGetIndentOfCurrStmtDelimiterSameLine()
           
 void testGetIndentOfCurrStmtEndOfDoc()
           
 void testGetIndentOfCurrStmtIgnoreDelimsInParenPhrase()
           
 void testGetIndentOfCurrStmtMultipleLines()
           
 void testGetIntelligentBeginLinePos()
          Tests that the "intelligent" beginning of line can be found, given a position on the line.
 void testGetLineEndPos()
           
 void testGetLineFirstCharPos()
           
 void testGetLineStartPos()
           
 void testPosInParenPhrase()
           
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
_assertContents, _setDocText, setUp, tearDown
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndentHelperTest

public IndentHelperTest()
Method Detail

findPrevDelimiter

private int findPrevDelimiter(int pos,
                              char[] delimiters)
                       throws BadLocationException
Convenience method that wraps _doc.findPrevDelimiter calls in a read lock.

Throws:
BadLocationException

_inParenPhrase

private boolean _inParenPhrase(int pos)
                        throws BadLocationException
Convenience method that wraps _doc.inParenPhrase calls in a read lock.

Throws:
BadLocationException

_getIndentOfCurrStmt

private int _getIndentOfCurrStmt(int pos)
                          throws BadLocationException
Convenience method that wraps _doc.getIndentOfCurrStmt calls in a read lock.

Throws:
BadLocationException

_getLineStartPos

private int _getLineStartPos(int pos)
                      throws BadLocationException
Convenience method that wraps _doc.getLineStartPos calls in a read lock.

Throws:
BadLocationException

_getLineEndPos

private int _getLineEndPos(int pos)
                    throws BadLocationException
Convenience method that wraps _doc.getLineEndPos calls in a read lock.

Throws:
BadLocationException

_getLineFirstCharPos

private int _getLineFirstCharPos(int pos)
                          throws BadLocationException
Convenience method that wraps _doc.getLineFirstCharPos calls in a read lock.

Throws:
BadLocationException

getFirstNonWSCharPos

private int getFirstNonWSCharPos(int pos)
                          throws BadLocationException
Convenience method that wraps _doc.getFirstNonWSCharPos calls in a read lock.

Throws:
BadLocationException

testFindPrevDelimiter

public void testFindPrevDelimiter()
                           throws BadLocationException
Tests findPrevDelimiter()

Throws:
BadLocationException

testPosInParenPhrase

public void testPosInParenPhrase()
                          throws BadLocationException
Throws:
BadLocationException

testGetIndentOfCurrStmtDelimiters

public void testGetIndentOfCurrStmtDelimiters()
                                       throws BadLocationException
Throws:
BadLocationException

testGetIndentOfCurrStmtDelimiterSameLine

public void testGetIndentOfCurrStmtDelimiterSameLine()
                                              throws BadLocationException
Throws:
BadLocationException

testGetIndentOfCurrStmtMultipleLines

public void testGetIndentOfCurrStmtMultipleLines()
                                          throws BadLocationException
Throws:
BadLocationException

testGetIndentOfCurrStmtIgnoreDelimsInParenPhrase

public void testGetIndentOfCurrStmtIgnoreDelimsInParenPhrase()
                                                      throws BadLocationException
Throws:
BadLocationException

testGetIndentOfCurrStmtEndOfDoc

public void testGetIndentOfCurrStmtEndOfDoc()
                                     throws BadLocationException
Throws:
BadLocationException

testGetLineStartPos

public void testGetLineStartPos()
                         throws BadLocationException
Throws:
BadLocationException

testGetLineEndPos

public void testGetLineEndPos()
                       throws BadLocationException
Throws:
BadLocationException

testGetLineFirstCharPos

public void testGetLineFirstCharPos()
                             throws BadLocationException
Throws:
BadLocationException

testGetFirstNonWSCharPos

public void testGetFirstNonWSCharPos()
                              throws BadLocationException
Throws:
BadLocationException

testGetIntelligentBeginLinePos

public void testGetIntelligentBeginLinePos()
                                    throws BadLocationException
Tests that the "intelligent" beginning of line can be found, given a position on the line. Very similar to getFirstNonWSCharPos, except that comments are treated as non-whitespace, and less parsing needs to be done.

Throws:
BadLocationException