--- /dev/null
+package no.uio.ifi.refaktor.tests;
+
+import no.uio.ifi.refaktor.analyze.ProjectWideSearchBasedExtractAndMoveMethodAnalyzer;
+import no.uio.ifi.refaktor.changers.RefaktorChanger;
+import no.uio.ifi.refaktor.changers.RefaktorChangerException;
+import no.uio.ifi.refaktor.changers.SearchBasedAnalyzerChanger;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ProjectWideSearchBasedExtractAndMoveMethodChanger implements RefaktorChanger {
+
+ private SearchBasedAnalyzerChanger changer;
+
+ public ProjectWideSearchBasedExtractAndMoveMethodChanger(IProject project) {
+ changer = new SearchBasedAnalyzerChanger(new ProjectWideSearchBasedExtractAndMoveMethodAnalyzer(project));
+ }
+
+ @Override
+ public void checkPreconditions() throws RefaktorChangerException {
+ changer.checkPreconditions();
+ }
+
+ @Override
+ public void executeChange(IProgressMonitor monitor) throws CoreException {
+ changer.executeChange(monitor);
+ }
+
+}
--- /dev/null
+package no.uio.ifi.refaktor.tests;
+
+import static no.uio.ifi.refaktor.RefaktorAssert.assertThat;
+import static org.junit.Assert.fail;
+import no.uio.ifi.refaktor.changers.RefaktorChanger;
+import no.uio.ifi.refaktor.changers.RefaktorChangerException;
+import no.uio.ifi.refaktor.examples.manager.ExampleCodeManager;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProjectWideSearchBasedExtractAndMoveMethodChangerTest {
+
+ @Before
+ public void setUp() throws Exception {
+ ExampleCodeManager.INSTANCE.loadExampleCode();
+ }
+
+ @Test
+ public void testAnalyzeAndChange() {
+ RefaktorChanger changer = new ProjectWideSearchBasedExtractAndMoveMethodChanger(ExampleCodeManager.INSTANCE.getProject());
+ try {
+ changer.checkPreconditions();
+ changer.executeChange(new NullProgressMonitor());
+ } catch (RefaktorChangerException e) {
+ fail("Preconditions failed to validate.A");
+ } catch (CoreException e) {
+ fail("Execution failed.");
+ }
+
+ ExampleCodeManager.INSTANCE.cleanBuild();
+ assertThat("Project has errors after change.", !ExampleCodeManager.INSTANCE.projectHasErrors());
+ }
+}