edu.rice.cs.drjava.model
Class FindReplaceMachineTest

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.FindReplaceMachineTest
All Implemented Interfaces:
Test

public class FindReplaceMachineTest
extends DrJavaTestCase

Tests the FindReplaceMachine.

Version:
$Id: FindReplaceMachineTest.java 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
FindReplaceMachineTest()
           
 
Method Summary
 void setUp()
          Initializes the document for the tests.
 void tearDown()
          Clean up for every test case.
 void testAnyOccurrenceSearchIgnore()
           
 void testCreateMachineSuccess()
           
 void testFindMatchWithCaretInMiddle()
           
 void testFindMatchWithCaretInMiddleBackwards()
           
 void testFindMultiLine()
           
 void testFindNextAndFailIsOnMatch()
           
 void testFindNextOnSuffix()
           
 void testFindNextUpdatesCurrent()
           
 void testFindNoMatchCase()
           
 void testFindPartialSubstrings()
          This test checks that a findNext won't find two matches that partially overlap.
 void testFindPrevOnPrefix()
           
 void testFindReplaceInAllOpenFiles()
          This test addresses feature request #784514 Find/Replace in all Open Files.
 void testFindReplaceInAllOpenFilesWholeWord()
           
 void testMultipleCallsToFindNext()
           
 void testNotInDocument()
           
 void testReplaceAllBackwards()
           
 void testReplaceAllContinue()
           
 void testReplaceAllContinueNoMatchCase()
           
 void testReplaceAllSameWord()
          This test checks that replacing a word with itself will halt on replace all.
 void testReplaceCreatesMatch()
          This tests that a replace all where the replacement action creates a new match does not replace this new match
 void testReplaceCreatesMatchBackwards()
          This tests that a replace all backwards where the replacement action creates a new match does not replace this new match
 void testSearchesDoNotRepeatWhenChangingDirection()
          This test addresses bug #745714 Searches Repeat When Changing Direction.
 void testSimpleReplace()
           
 void testStartFromTopContinue()
           
 void testWholeWordSearchIgnore()
           
 void testWholeWordSearchOnTestString1()
           
 
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

FindReplaceMachineTest

public FindReplaceMachineTest()
Method Detail

setUp

public void setUp()
           throws Exception
Initializes the document for the tests.

Overrides:
setUp in class DrJavaTestCase
Throws:
Exception - This convention is mandated by JUnit.TestCase, the superclass of this class.

tearDown

public void tearDown()
              throws Exception
Description copied from class: DrJavaTestCase
Clean up for every test case. Only used in unit tests. Added because Windows would intermittently throw a java.util.concurrent.RejectedExecutionException during cleanup.

Overrides:
tearDown in class DrJavaTestCase
Throws:
Exception

testCreateMachineSuccess

public void testCreateMachineSuccess()
                              throws BadLocationException
Throws:
BadLocationException

testFindNextUpdatesCurrent

public void testFindNextUpdatesCurrent()
                                throws BadLocationException
Throws:
BadLocationException

testFindNextAndFailIsOnMatch

public void testFindNextAndFailIsOnMatch()
                                  throws BadLocationException
Throws:
BadLocationException

testFindNextOnSuffix

public void testFindNextOnSuffix()
                          throws BadLocationException
Throws:
BadLocationException

testFindPrevOnPrefix

public void testFindPrevOnPrefix()
                          throws BadLocationException
Throws:
BadLocationException

testMultipleCallsToFindNext

public void testMultipleCallsToFindNext()
                                 throws BadLocationException
Throws:
BadLocationException

testStartFromTopContinue

public void testStartFromTopContinue()
                              throws BadLocationException
Throws:
BadLocationException

testNotInDocument

public void testNotInDocument()
                       throws BadLocationException
Throws:
BadLocationException

testSimpleReplace

public void testSimpleReplace()
                       throws BadLocationException
Throws:
BadLocationException

testReplaceAllContinue

public void testReplaceAllContinue()
                            throws BadLocationException
Throws:
BadLocationException

testFindNoMatchCase

public void testFindNoMatchCase()
                         throws BadLocationException
Throws:
BadLocationException

testReplaceAllContinueNoMatchCase

public void testReplaceAllContinueNoMatchCase()
                                       throws BadLocationException
Throws:
BadLocationException

testReplaceAllBackwards

public void testReplaceAllBackwards()
                             throws BadLocationException
Throws:
BadLocationException

testFindMatchWithCaretInMiddle

public void testFindMatchWithCaretInMiddle()
                                    throws BadLocationException
Throws:
BadLocationException

testFindMatchWithCaretInMiddleBackwards

public void testFindMatchWithCaretInMiddleBackwards()
                                             throws BadLocationException
Throws:
BadLocationException

testReplaceCreatesMatch

public void testReplaceCreatesMatch()
                             throws BadLocationException
This tests that a replace all where the replacement action creates a new match does not replace this new match

Throws:
BadLocationException

testReplaceCreatesMatchBackwards

public void testReplaceCreatesMatchBackwards()
                                      throws BadLocationException
This tests that a replace all backwards where the replacement action creates a new match does not replace this new match

Throws:
BadLocationException

testReplaceAllSameWord

public void testReplaceAllSameWord()
                            throws BadLocationException
This test checks that replacing a word with itself will halt on replace all.

Throws:
BadLocationException

testFindPartialSubstrings

public void testFindPartialSubstrings()
                               throws BadLocationException
This test checks that a findNext won't find two matches that partially overlap. This is the current behavior of the FindReplaceMachine, though at some time in the future someone may want to change it.

Throws:
BadLocationException

testSearchesDoNotRepeatWhenChangingDirection

public void testSearchesDoNotRepeatWhenChangingDirection()
                                                  throws BadLocationException
This test addresses bug #745714 Searches Repeat When Changing Direction. The word that was just found should not be found again after toggling the search backwards flag.

Throws:
BadLocationException

testFindReplaceInAllOpenFiles

public void testFindReplaceInAllOpenFiles()
                                   throws BadLocationException
This test addresses feature request #784514 Find/Replace in all Open Files.

Throws:
BadLocationException

testFindReplaceInAllOpenFilesWholeWord

public void testFindReplaceInAllOpenFilesWholeWord()
                                            throws BadLocationException
Throws:
BadLocationException

testFindMultiLine

public void testFindMultiLine()
                       throws BadLocationException
Throws:
BadLocationException

testWholeWordSearchOnTestString1

public void testWholeWordSearchOnTestString1()
                                      throws BadLocationException
Throws:
BadLocationException

testWholeWordSearchIgnore

public void testWholeWordSearchIgnore()
                               throws BadLocationException
Throws:
BadLocationException

testAnyOccurrenceSearchIgnore

public void testAnyOccurrenceSearchIgnore()
                                   throws BadLocationException
Throws:
BadLocationException