Adjust test suite after JDT/UI's migration to JUnit4

- refactoring tests - part 2
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java
index c4a638d..06f7d13 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java
@@ -22,33 +22,38 @@
  **********************************************************************/
 package org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod;

 

+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 /**

  * @author brcan

  *

  */

-import java.io.IOException;

-import java.io.InputStream;

-

-import org.eclipse.core.runtime.CoreException;

-import org.eclipse.core.runtime.IProgressMonitor;

-import org.eclipse.core.runtime.NullProgressMonitor;

-import org.eclipse.jdt.core.ICompilationUnit;

-import org.eclipse.jdt.core.IPackageFragment;

-import org.eclipse.jdt.core.JavaCore;

-import org.eclipse.jdt.ui.tests.refactoring.infra.AbstractCUTestCase;

-import org.eclipse.jface.text.ITextSelection;

-import org.eclipse.jface.text.TextSelection;

-import org.eclipse.ltk.core.refactoring.Change;

-import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;

-import org.eclipse.ltk.core.refactoring.IUndoManager;

-import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;

-import org.eclipse.ltk.core.refactoring.Refactoring;

-import org.eclipse.ltk.core.refactoring.RefactoringCore;

-import org.eclipse.ltk.core.refactoring.RefactoringStatus;

-import org.eclipse.objectteams.otdt.ui.tests.refactoring.OTRefactoringTestPlugin;

+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.tests.refactoring.infra.AbstractJunit4CUTestCase;
+import org.eclipse.jdt.ui.tests.refactoring.rules.RefactoringTestSetup;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
+import org.eclipse.ltk.core.refactoring.IUndoManager;
+import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringCore;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.objectteams.otdt.ui.tests.refactoring.OTRefactoringTestPlugin;
+import org.junit.Rule;
 

 @SuppressWarnings({ "nls", "restriction" })

-public abstract class AbstractSelectionTestCase extends AbstractCUTestCase

+public abstract class AbstractSelectionTestCase extends AbstractJunit4CUTestCase

 {

 	public static final String SQUARE_BRACKET_OPEN = "/*[*/";

 	public static final int    SQUARE_BRACKET_OPEN_LENGTH = SQUARE_BRACKET_OPEN.length();

@@ -59,10 +64,8 @@
 	protected static final int INVALID_SELECTION   = 2;

 	protected static final int COMPARE_WITH_OUTPUT = 3;

 

-	public AbstractSelectionTestCase(String name)

-	{

-		super(name);

-	}

+	@Rule
+	public RefactoringTestSetup rts= new RefactoringTestSetup();

 

 	protected int[] getSelection(String source)

 	{

diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java
index b6f9013..91e7a30 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java
@@ -23,30 +23,20 @@
 package org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod;

 

 

-import junit.framework.Test;

-import junit.framework.TestSuite;

+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;

 

 /**

  * @author brcan

  *

  * Runs all OT-specific refactoring tests and corresponding eclipse refactoring tests

- */

-public class AllTests

-{

+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+	org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodTests.class,

+	org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodRefactoringUtilTests.class,

+	org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractTempTests.class,

+})

+public class AllTests {

 

-    public static void main(String[] args)

-    {

-        junit.textui.TestRunner.run(AllTests.suite());

-    }

-

-    public static Test suite()

-    {

-        TestSuite suite = new TestSuite(

-                "All OT-Extract-Method-Refactoring Tests");

-

-        suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodTests.suite());

-        suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodRefactoringUtilTests.suite());

-        suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractTempTests.suite());

-        return suite;

-    }

 }

diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
index dbf12fa..4846bb8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
@@ -22,30 +22,29 @@
  **********************************************************************/
 package org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod;

 

-import java.util.Hashtable;

-

-import junit.extensions.TestSetup;

-import junit.framework.Test;

-

-import org.eclipse.core.resources.IWorkspace;

-import org.eclipse.core.resources.IWorkspaceDescription;

-import org.eclipse.core.resources.ResourcesPlugin;

-import org.eclipse.jdt.core.IJavaProject;

-import org.eclipse.jdt.core.IPackageFragment;

-import org.eclipse.jdt.core.IPackageFragmentRoot;

-import org.eclipse.jdt.core.JavaCore;

-import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;

-import org.eclipse.jdt.internal.ui.JavaPlugin;

-import org.eclipse.jdt.ui.tests.refactoring.RefactoringTest;

-import org.eclipse.ltk.core.refactoring.RefactoringCore;

-import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;

-import org.eclipse.objectteams.otdt.ui.tests.util.TestOptions;

+import java.util.Hashtable;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.ltk.core.refactoring.RefactoringCore;
+import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;
+import org.eclipse.objectteams.otdt.ui.tests.util.TestOptions;
+import org.junit.rules.ExternalResource;

 

 /**

  * @author brcan

  */

-@SuppressWarnings({ "nls", "restriction" })

-public class ExtractMethodTestSetup extends TestSetup

+@SuppressWarnings({ "restriction" })

+public class ExtractMethodTestSetup extends ExternalResource

 {

 	private IJavaProject _javaProject;

 	private IPackageFragmentRoot _root;

@@ -62,19 +61,13 @@
 	private IPackageFragment _overloadingPackage;
 	private IPackageFragment _syntaxPackage;

 

-    public ExtractMethodTestSetup(Test test)

-    {

-        super(test);

-    }

-

 	public IPackageFragmentRoot getRoot() {

 		return _root;

 	}

 

-    @SuppressWarnings("unchecked")

-	protected void setUp() throws Exception

+	protected void before() throws Exception

     {

-		Hashtable options = TestOptions.getFormatterOptions();

+		Hashtable<String, String> options = TestOptions.getFormatterOptions();

 		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.TAB);

 		options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");

 		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");

@@ -105,10 +98,16 @@
 //		_selectionPackage = getRoot().createPackageFragment("selection", true, null);

     }

 

-	protected void tearDown() throws Exception

+	protected void after()

 	{

-		JavaProjectHelper.performDummySearch(_javaProject);

-		JavaProjectHelper.delete(_javaProject);

+		try {
+			JavaProjectHelper.performDummySearch(_javaProject);

+			JavaProjectHelper.delete(_javaProject);
+		} catch (JavaModelException e) {
+			e.printStackTrace();
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}

 	}

 

 //	public IPackageFragment getSelectionPackage()

diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
index 0f8a78d..088adc3 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
@@ -27,9 +27,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IPackageFragment;
@@ -38,8 +35,12 @@
 import org.eclipse.jdt.internal.corext.refactoring.ParameterInfo;
 import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.junit.Rule;
+import org.junit.Test;
 import org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodRefactoring;
 
+import static org.junit.Assert.*;
+
 /**
  * @author brcan
  *
@@ -47,18 +48,8 @@
 @SuppressWarnings({ "nls", "restriction" })
 public class ExtractMethodTests extends AbstractSelectionTestCase
 {
-	private static ExtractMethodTestSetup _testSetup;
-
-    public ExtractMethodTests(String name)
-    {
-        super(name);
-    }
-
-    public static Test suite()
-    {
-		_testSetup = new ExtractMethodTestSetup(new TestSuite(ExtractMethodTests.class));
-		return _testSetup;
-	}
+	@Rule
+	public ExtractMethodTestSetup _testSetup = new ExtractMethodTestSetup();
 
 	protected IPackageFragmentRoot getRoot()
 	{
@@ -193,6 +184,7 @@
 	//=====================================================================================
 
 	//extract method invocation in team
+	@Test
 	public void testTeamclass1() throws Exception
     {
 	    performTest(
@@ -202,6 +194,7 @@
 	            "team_out");
     }
 	//extract expression in team
+	@Test
 	public void testTeamclass2() throws Exception
     {
 	    performTest(
@@ -216,6 +209,7 @@
 	//=====================================================================================
 
 	//extract method invocation in unbound role
+	@Test
 	public void testRoleclass1() throws Exception
     {
 	    performTest(
@@ -225,6 +219,7 @@
 	            "role_out");
     }
 	//extract expression in unbound role
+	@Test
 	public void testRoleclass2() throws Exception
 	{
 	    performTest(
@@ -240,6 +235,7 @@
 
 	/* passing */
 	//extract method invocation in unbound nested team
+	@Test
 	public void testNestedTeam1() throws Exception
     {
 	    performTest(
@@ -249,6 +245,7 @@
 	            "nestedTeam_out");
     }
 	//extract method invocation in inner role of unbound nested team
+	@Test
 	public void testNestedTeam2() throws Exception
     {
 	    performTest(
@@ -260,6 +257,7 @@
 
 	/* failing */
 	//extract method invocation in bound nested team -> ambiguous base method spec
+	@Test
 	public void testNestedTeam3() throws Exception
     {
 		performTest(
@@ -269,6 +267,7 @@
 		        "nestedTeam_out");
     }
 	//extract method invocation in bound nested team -> ambiguous role method spec
+	@Test
 	public void testNestedTeam4() throws Exception
     {
 		performTest(
@@ -279,6 +278,7 @@
     }
 	//extract method invocation in bound inner role of nested team ->
 	//ambiguous base method spec
+	@Test
 	public void testNestedTeam5() throws Exception
     {
 		performTest(
@@ -289,6 +289,7 @@
     }
 	//extract method invocation in bound inner role of nested team ->
 	//ambiguous role method spec
+	@Test
 	public void testNestedTeam6() throws Exception
     {
 		performTest(
@@ -303,6 +304,7 @@
 	//=====================================================================================
 
 	//extract method invocation in role file (unbound role)
+	@Test
 	public void testRoleFile1() throws Exception
 	{
 		establishTeamCU("TeamWithRoleFile.java");
@@ -315,6 +317,7 @@
 	}
 
 	//extract expression in role file (unbound role)
+	@Test
 	public void testRoleFile2() throws Exception
 	{
 		establishTeamCU("TeamWithRoleFile.java");
@@ -337,6 +340,7 @@
 	//	=====================================================================================
 
 	//focus implicit role hierarchy
+	@Test
 	public void testFocusTypeIsSuperroleInRoleHierarchy() throws Exception
     {
 		performTest(
@@ -346,6 +350,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsMiddleRoleInRoleHierarchy() throws Exception
     {
 		performTest(
@@ -355,6 +360,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsLowestRoleInRoleHierarchy() throws Exception
     {
 		performTest(
@@ -365,6 +371,7 @@
     }
 
 	//focus base hierarchy
+	@Test
 	public void testFocusTypeIsSuperBasetypeInBaseHierarchy() throws Exception
     {
 		performTest(
@@ -374,6 +381,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsMiddleBasetypeInBaseHierarchy() throws Exception
     {
 		performTest(
@@ -383,6 +391,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsLowestBasetypeInBaseHierarchy() throws Exception
     {
 		performTest(
@@ -393,6 +402,7 @@
     }
 
 	//focus team hierarchy
+	@Test
 	public void testFocusTypeIsSuperteamInTeamHierachy() throws Exception
     {
 		performTest(
@@ -402,6 +412,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsMiddleTeamInTeamHierachy() throws Exception
     {
 		performTest(
@@ -411,6 +422,7 @@
 		        "focusType_out");
     }
 
+	@Test
 	public void testFocusTypeIsLowestTeamInTeamHierarchy() throws Exception
     {
 		performTest(
@@ -421,6 +433,7 @@
     }
 
 	// role is a indirect subclass of target class, explicit inheritance only, short methodSpec
+	@Test
 	public void test20() throws Exception
 	{
 		performTest(
@@ -431,6 +444,7 @@
 	}
 
 	// role is a indirect subclass of target class, explicit + implicit inheritance, short methodSpec
+	@Test
 	public void test21() throws Exception
 	{
 		performTest(
@@ -441,6 +455,7 @@
 	}
 
 	// role is a indirect subclass of target class, explicit + implicit inheritance, long methodSpec
+	@Test
 	public void test22() throws Exception
 	{
 		performTest(
@@ -451,6 +466,7 @@
 	}
 
 	// bound base class is target class, short methodSpec
+	@Test
 	public void test23() throws Exception
 	{
 		performTest(
@@ -461,6 +477,7 @@
 	}
 
 	// bound base class is direct/indirect subclass of target class, short methodSpec
+	@Test
 	public void test24() throws Exception
 	{
 		performTest(
@@ -471,6 +488,7 @@
 	}
 
 	// base class is subclass of target class, long methodSpec
+	@Test
 	public void test25() throws Exception
 	{
 		performTest(
@@ -485,6 +503,7 @@
 	//	=====================================================================================
 
 	// call target is a declared-lifting argument
+	@Test
 	public void testDeclaredLifting1() throws Exception
 	{
 		performTest(
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java
index b0f481d..633cf03 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java
@@ -22,29 +22,28 @@
  **********************************************************************/
 package org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod;

 

-import java.util.Hashtable;

-

-import junit.extensions.TestSetup;

-import junit.framework.Test;

-

-import org.eclipse.core.resources.IWorkspace;

-import org.eclipse.core.resources.IWorkspaceDescription;

-import org.eclipse.core.resources.ResourcesPlugin;

-import org.eclipse.jdt.core.IJavaProject;

-import org.eclipse.jdt.core.IPackageFragment;

-import org.eclipse.jdt.core.IPackageFragmentRoot;

-import org.eclipse.jdt.core.JavaCore;

-import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;

-import org.eclipse.jdt.internal.ui.JavaPlugin;

-import org.eclipse.jdt.ui.tests.refactoring.RefactoringTest;

-import org.eclipse.ltk.core.refactoring.RefactoringCore;

-import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;

-import org.eclipse.objectteams.otdt.ui.tests.util.TestOptions;

+import java.util.Hashtable;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.ltk.core.refactoring.RefactoringCore;
+import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;
+import org.eclipse.objectteams.otdt.ui.tests.util.TestOptions;
+import org.junit.rules.ExternalResource;

 

 /**

  * @author stephan

  */

-public class ExtractTempTestSetup extends TestSetup

+public class ExtractTempTestSetup extends ExternalResource

 {

 	private IJavaProject _javaProject;

 	private IPackageFragmentRoot _root;

@@ -52,18 +51,14 @@
 

 	private IPackageFragment _statementsPackage;

 

-    public ExtractTempTestSetup(Test test)

-    {

-        super(test);

-    }

-

 	public IPackageFragmentRoot getRoot() {

 		return _root;

 	}

 

-    protected void setUp() throws Exception

+    @SuppressWarnings("restriction")
+	protected void before() throws Exception

     {

-		Hashtable options = TestOptions.getFormatterOptions();

+		Hashtable<String, String> options = TestOptions.getFormatterOptions();

 		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.TAB);

 		options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");

 		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");

@@ -85,10 +80,16 @@
 		_statementsPackage = getRoot().createPackageFragment("statements_in", true, null);

     }

 

-	protected void tearDown() throws Exception

-	{

-		JavaProjectHelper.performDummySearch(_javaProject);

-		JavaProjectHelper.delete(_javaProject);

+	@SuppressWarnings("restriction")
+	protected void after() {

+		try {
+			JavaProjectHelper.performDummySearch(_javaProject);
+			JavaProjectHelper.delete(_javaProject);
+		} catch (JavaModelException e) {
+			e.printStackTrace();

+		} catch (CoreException e) {
+			e.printStackTrace();
+		}

 	}

 

 	public IPackageFragment getStatementsPackage()

diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java
index d07f7d7..f3463b5 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java
@@ -22,8 +22,6 @@
  **********************************************************************/
 package org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -35,6 +33,10 @@
 import org.eclipse.jdt.ui.tests.refactoring.infra.TextRangeUtil;
 import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * @author stephan
@@ -43,18 +45,8 @@
 @SuppressWarnings("restriction")
 public class ExtractTempTests extends AbstractSelectionTestCase
 {
-	private static ExtractTempTestSetup _testSetup;
-
-    public ExtractTempTests(String name)
-    {
-        super(name);
-    }
-
-    public static Test suite()
-    {
-		_testSetup = new ExtractTempTestSetup(new TestSuite(ExtractTempTests.class));
-		return _testSetup;
-	}
+	@Rule
+	public ExtractTempTestSetup _testSetup = new ExtractTempTestSetup();
 
 	protected IPackageFragmentRoot getRoot()
 	{
@@ -171,6 +163,7 @@
 	//=====================================================================================
 
 	//extract team instantiation expression "new T_x()" from within.team_expression
+	@Test
 	public void testWithin1() throws Exception
     {
 	    performTest(9, 16, 9, 35,
@@ -178,6 +171,7 @@
 	            	"statements_out");
     }
 	// body is single statement instead of block
+	@Test
 	public void testWithin2() throws Exception
     {
 	    performTest(9, 16, 9, 35,
@@ -186,6 +180,7 @@
     }
 
 	// two element path, extracted is a dependent type
+	@Test
 	public void testTypeAnchor1() throws Exception
 	{
 		performTest(15,13,15,18,
@@ -194,6 +189,7 @@
 	}
 
 	// three element path, extracted is not a dependent type
+	@Test
 	public void testTypeAnchor2() throws Exception
 	{
 		performTest(21,13,21,20,
@@ -202,6 +198,7 @@
 	}
 
 	// three element path, extracted is a dependent type
+	@Test
 	public void testTypeAnchor3() throws Exception
 	{
 		performTest(19,13,19,20,